reportList.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386
  1. <template>
  2. <view class="report-list-page">
  3. <van-sticky style="background: #fff">
  4. <view class="flex search-wrap">
  5. <view style="flex: 1" @click="goSearch" >
  6. <searchBox
  7. placeholder="请输入报告标题或关键字"
  8. :hasRightBtn="false"
  9. :disabled="true"
  10. ></searchBox>
  11. </view>
  12. <view class="filter-box" @click="showFilter=true" v-if="classifyList.length>0">
  13. <image src="./static/filter-icon.png" mode="aspectFill"></image>
  14. <text>筛选</text>
  15. </view>
  16. </view>
  17. </van-sticky>
  18. <view class="report-empty-box" v-if="finished&&list.length==0">
  19. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  20. <view>{{searchVal?'找不到对应报告,试试别的搜索词吧':'暂无报告'}}</view>
  21. </view>
  22. <view class="report-list-wrap" :style="{paddingBottom:showAudioPop&&'150px'}" v-else>
  23. <view class="flex item" v-for="item in list" :key="item.report_id" @click="goReportDetail(item)">
  24. <image class="img" :src="item.report_img_url" mode="aspectFill" lazy-load />
  25. <view class="con">
  26. <view class="title" v-html="item.title"></view>
  27. <view class="info" v-html="item.classify_name_second"></view>
  28. <view class="time">{{item.stage}}期 | {{item.publish_time|formatReportTime}}</view>
  29. <view :class="['audio-box',!item.auth_ok&&'grey-audio-box']" @click.stop="handleClickAudio(item)" v-if="item.auth_ok">
  30. <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'./static/audio-s.png':'./static/audio.png'" mode="aspectFill"/>
  31. <text>{{curAudioReportId==item.report_id&&!curAudioPaused?'暂停':'播放'}}</text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 筛选 -->
  37. <van-popup :show="showFilter" position="bottom" :safe-area-inset-bottom="false" round @close="showFilter=false">
  38. <view class="filter-wrap">
  39. <view class="flex top">
  40. <text style="color:#000">筛选</text>
  41. <text style="color:#E3B377" @click="showFilter=false">取消</text>
  42. </view>
  43. <view class="list-box">
  44. <van-row gutter="10">
  45. <van-col span="8" v-for="item in classifyList" :key="item.classify_id_second">
  46. <view
  47. :class="['item',item.classify_id_second==selectSecClassifyId&&'active']"
  48. @click="handleSelectSecClassifyId(item)"
  49. >{{item.classify_second_simple}}</view>
  50. </van-col>
  51. </van-row>
  52. </view>
  53. </view>
  54. </van-popup>
  55. <!-- 音频弹窗 -->
  56. <audioBox v-if="showAudioPop"></audioBox>
  57. <!-- 分享海报 -->
  58. <sharePoster
  59. :style="{bottom:'190rpx'}"
  60. :shareData="{
  61. type:'report_list',
  62. code_page:'pages-report/reportList',
  63. code_scene:code_scene,
  64. data:shareParams
  65. }"></sharePoster>
  66. </view>
  67. </template>
  68. <script>
  69. import searchBox from "./components/searchBox.vue";
  70. import audioBox from './components/audioBox.vue'
  71. import sharePoster from '@/components/sharePoster/sharePoster.vue'
  72. import {apiReportList,apiSubClassifyList} from '@/api/report'
  73. import {apiGetSceneToParams} from '@/api/common'
  74. const moment=require('@/utils/moment-with-locales.min')
  75. export default {
  76. computed: {
  77. showAudioPop(){//是否显示音频弹窗
  78. return this.$store.state.report.audioData.show
  79. },
  80. curAudioReportId(){//当前播放的音频所属报告
  81. return this.$store.state.report.audioData.reportId
  82. },
  83. curAudioPaused(){//当前音频是否暂停状态
  84. return this.$store.state.report.audioData.paused
  85. },
  86. shareParams(){
  87. let obj={
  88. list_title:this.classifyName,
  89. img_1:'',
  90. title_1:'',
  91. abstract_1:'',
  92. time_1:'',
  93. img_2:'',
  94. title_2:'',
  95. abstract_2:'',
  96. time_2:'',
  97. }
  98. if(this.list[0]){
  99. obj.img_1=this.list[0].report_img_url
  100. obj.title_1=this.list[0].title
  101. obj.abstract_1=this.list[0].classify_name_second
  102. obj.time_1=`${this.list[0].stage}期 | ${moment(this.list[0].publish_time).format('YYYY.MM.DD')}`
  103. }
  104. if(this.list[1]){
  105. obj.img_2=this.list[1].report_img_url
  106. obj.title_2=this.list[1].title
  107. obj.abstract_2=this.list[1].classify_name_second
  108. obj.time_2=`${this.list[1].stage}期 | ${moment(this.list[1].publish_time).format('YYYY.MM.DD')}`
  109. }
  110. return obj
  111. },
  112. code_scene(){
  113. return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
  114. }
  115. },
  116. components: {
  117. searchBox,
  118. audioBox
  119. },
  120. data() {
  121. return {
  122. classifyId:0,
  123. classifyName:'',
  124. classifyList:[],
  125. selectSecClassifyId:0,
  126. searchVal: "",
  127. showFilter:false,
  128. list:[],
  129. finished:false,
  130. page:1,
  131. pageSize:20
  132. };
  133. },
  134. onLoad(options) {
  135. if(options.scene){
  136. this.init(options.scene)
  137. }else{
  138. this.classifyId=options.classifyId
  139. this.classifyName=decodeURIComponent(options.classifyName)
  140. // 设置title
  141. uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
  142. this.getList()
  143. this.getClassifyList()
  144. }
  145. },
  146. onPullDownRefresh() {
  147. this.page=1
  148. this.list=[]
  149. this.finished=false
  150. this.getList()
  151. this.getClassifyList()
  152. setTimeout(() => {
  153. uni.stopPullDownRefresh()
  154. }, 1500);
  155. },
  156. onReachBottom() {
  157. if(this.finished) return
  158. this.page++
  159. this.getList()
  160. },
  161. onShareAppMessage() {
  162. return {
  163. title:`FICC【${this.classifyName}】`
  164. }
  165. },
  166. methods: {
  167. async init(e){
  168. const res=await apiGetSceneToParams({scene_key:e})
  169. if(res.code==200){
  170. const obj=JSON.parse(res.data)
  171. this.classifyId=obj.classifyId
  172. this.classifyName=decodeURIComponent(obj.classifyName)
  173. uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
  174. this.getList()
  175. this.getClassifyList()
  176. }
  177. },
  178. //获取研报列表
  179. async getList(){
  180. const res=await apiReportList({
  181. classify_id_first:Number(this.classifyId),
  182. classify_id_second:Number(this.selectSecClassifyId),
  183. key_word:this.searchVal,
  184. current_index:this.page,
  185. page_size:this.pageSize
  186. })
  187. if(res.code===200){
  188. let arr=res.data.list||[]
  189. this.list=[...this.list,...arr]
  190. if(res.data.paging.is_end){
  191. this.finished=true
  192. }
  193. }
  194. },
  195. //分类数据
  196. async getClassifyList(){
  197. const res=await apiSubClassifyList({classify_id_first:Number(this.classifyId)})
  198. if(res.code===200){
  199. this.classifyList=res.data
  200. }
  201. },
  202. handleSelectSecClassifyId(item){
  203. if(this.selectSecClassifyId==item.classify_id_second){
  204. this.selectSecClassifyId=''
  205. }else{
  206. this.selectSecClassifyId=item.classify_id_second
  207. }
  208. this.showFilter=false
  209. this.page=1
  210. this.finished=false
  211. this.list=[]
  212. this.getList()
  213. },
  214. onChange(e) {
  215. this.searchVal = e;
  216. },
  217. onSearch() {
  218. console.log("搜索", this.searchVal);
  219. this.page=1
  220. this.finished=false
  221. this.list=[]
  222. this.getList()
  223. },
  224. goReportDetail(item){
  225. uni.navigateTo({ url: '/pages-report/reportDetail?reportId='+item.report_id })
  226. },
  227. handleClickAudio(item){
  228. if(!item.auth_ok) return
  229. if(!item.video_list||item.video_list.length==0){
  230. uni.showToast({
  231. title: '暂无音频',
  232. icon: 'none'
  233. })
  234. return
  235. }
  236. // 判断是否为同一个音频
  237. if(this.$store.state.report.audioData.reportId==item.report_id){
  238. if(this.globalBgMusic.paused){
  239. this.globalBgMusic.play()
  240. this.$store.commit('showPopAudio')
  241. }else{
  242. this.globalBgMusic.pause()
  243. }
  244. }else{
  245. this.$store.commit('addAudio', {list:item.video_list,reportId:item.report_id})
  246. }
  247. },
  248. // 跳转搜索
  249. goSearch(){
  250. uni.navigateTo({
  251. url:`/pages-report/reportListSearch?classify_id_first=${this.classifyId}&classifyName=${this.classifyName}`
  252. })
  253. }
  254. },
  255. };
  256. </script>
  257. <style>
  258. page{
  259. padding-bottom: 0;
  260. }
  261. </style>
  262. <style lang="scss" scoped>
  263. .search-wrap {
  264. background-color: #fff;
  265. padding: 30rpx 34rpx;
  266. align-items: center;
  267. .filter-box {
  268. margin-left: 20rpx;
  269. image {
  270. width: 52rpx;
  271. height: 52rpx;
  272. vertical-align: middle;
  273. }
  274. text {
  275. vertical-align: middle;
  276. color: #e3b377;
  277. font-size: 32rpx;
  278. }
  279. }
  280. }
  281. .report-list-wrap {
  282. padding: 0 34rpx;
  283. .item {
  284. padding-bottom: 30rpx;
  285. margin-bottom: 30rpx;
  286. border-bottom: 1px solid #EDEDED;
  287. .img {
  288. width: 120rpx;
  289. height: 180rpx;
  290. background-color: #f5f5f5;
  291. flex-shrink: 0;
  292. margin-right: 20rpx;
  293. border-radius: 16rpx;
  294. }
  295. .con {
  296. flex: 1;
  297. position: relative;
  298. overflow: hidden;
  299. .title {
  300. font-size: 32rpx;
  301. font-weight: bold;
  302. margin-bottom: 8rpx;
  303. }
  304. .time {
  305. position: absolute;
  306. color: #666666;
  307. bottom: 0;
  308. left: 0;
  309. font-size: 28rpx;
  310. }
  311. .audio-box {
  312. position: absolute;
  313. bottom: 0;
  314. right: 0;
  315. width: 99rpx;
  316. height: 39rpx;
  317. background: #E3B377;
  318. border-radius: 20rpx;
  319. color: #fff;
  320. font-size: 24rpx;
  321. display: flex;
  322. justify-content: center;
  323. align-items: center;
  324. image{
  325. width: 30rpx;
  326. height: 30rpx;
  327. margin-right: 4rpx;
  328. }
  329. }
  330. .grey-audio-box {
  331. background: linear-gradient(114deg, #b0b0b0 0%, #e5e2e2 100%);
  332. }
  333. }
  334. }
  335. }
  336. .filter-wrap{
  337. background-color: #fff;
  338. padding-top: 53rpx;
  339. .top{
  340. font-size: 32rpx;
  341. justify-content: space-between;
  342. margin-bottom: 40rpx;
  343. padding: 0 34rpx;
  344. }
  345. .list-box{
  346. min-height: 30vh;
  347. max-height: 60vh;
  348. overflow-y: auto;
  349. padding: 0 34rpx;
  350. .item{
  351. background-color: #F6F6F6;
  352. color: #000000;
  353. // text-align: center;
  354. height: 76rpx;
  355. overflow: hidden;
  356. display: flex;
  357. align-items: center;
  358. justify-content: center;
  359. // line-height: 76rpx;
  360. margin-bottom: 20rpx;
  361. }
  362. .active{
  363. background-color: #FAEEDE;
  364. }
  365. }
  366. }
  367. </style>