reportList.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  1. <template>
  2. <view class="report-list-page">
  3. <view class="top-filter-box">
  4. <view class="flex search-wrap">
  5. <view style="flex: 1">
  6. <searchBox
  7. placeholder="请输入报告标题或摘要或关键字"
  8. :hasRightBtn="false"
  9. :disabled="false"
  10. :clear="!searchVal"
  11. @change="onChange"
  12. @search="onSearch"
  13. ></searchBox>
  14. </view>
  15. <!-- <view class="filter-box" @click="showFilter=true" v-if="classifyList.length>0">
  16. <image src="./static/filter-icon.png" mode="aspectFill"></image>
  17. <text>筛选</text>
  18. </view> -->
  19. </view>
  20. <view class="tabs-box" v-if="classifyMenuList.length>0">
  21. <text
  22. :class="['sub-nav-item',0===selectClassifyMenu?'active':'']"
  23. @click="handleSelectMenu({menu_id:0,menu_name:'全部'})"
  24. >全部</text>
  25. <text
  26. :class="['sub-nav-item',item.menu_id===selectClassifyMenu?'active':'']"
  27. v-for="item in classifyMenuList"
  28. :key="item.menu_id"
  29. @click="handleSelectMenu(item)"
  30. >{{item.menu_name}}</text>
  31. </view>
  32. </view>
  33. <view class="report-empty-box" v-if="finished&&list.length==0">
  34. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  35. <view>{{searchVal?'找不到对应报告,试试别的搜索词吧':'暂无报告'}}</view>
  36. </view>
  37. <view class="report-list-wrap" :style="{paddingBottom:showAudioPop&&'150px'}" v-else>
  38. <view class="flex item" v-for="item in list" :key="item.report_id" @click="goReportDetail(item)">
  39. <image class="img" :src="item.report_img_url" mode="aspectFill" lazy-load />
  40. <view class="con">
  41. <view class="title" :style="!item.abstract.length?'min-height: 70rpx;':''" v-html="item.title"></view>
  42. <view class="abstract" v-html="item.abstract"></view>
  43. <view class="info">
  44. <view v-html="item.classify_name_third?item.classify_name_third:item.classify_name_second" style="display:inline-block"></view>
  45. <text v-if="item.classify_name_third||item.classify_name_second" style="display:inline-block;margin:0 10rpx">&nbsp;·&nbsp;</text>
  46. <text v-if="item.rai_report_id>0">{{item.publish_time|formatReportTime}}</text>
  47. <text v-else>{{item.stage}}期 | {{item.publish_time|formatReportTime}}</text>
  48. </view>
  49. <!-- 权益研报没有音频播放 -->
  50. <view class="audio-box" v-if="item.auth_ok&&item.rai_report_id===0" @click.stop="handleClickAudio(item)">
  51. <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'./static/a-play.png':'./static/a-pause.png'" mode="aspectFill"/>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. <!-- 筛选 -->
  57. <van-popup :show="showFilter" position="bottom" :safe-area-inset-bottom="false" round @close="showFilter=false">
  58. <view class="filter-wrap" @touchmove.stop>
  59. <view class="flex top">
  60. <text style="color:#000">筛选</text>
  61. <text style="color:#E3B377" @click="showFilter=false">取消</text>
  62. </view>
  63. <view class="list-box">
  64. <van-row gutter="10">
  65. <van-col span="8" v-for="item in classifyList" :key="item.classify_id_second">
  66. <view
  67. :class="['item',item.classify_id_second==selectSecClassifyId&&'active']"
  68. @click="handleSelectSecClassifyId(item)"
  69. >{{item.classify_second_simple}}</view>
  70. </van-col>
  71. </van-row>
  72. </view>
  73. </view>
  74. </van-popup>
  75. <!-- 音频弹窗 -->
  76. <audioBox v-if="showAudioPop"></audioBox>
  77. <!-- 分享海报 -->
  78. <sharePoster
  79. :style="{bottom:'190rpx'}"
  80. :shareData="{
  81. type:'report_list',
  82. code_page:'pages-report/reportList',
  83. code_scene:code_scene,
  84. data:shareParams
  85. }"></sharePoster>
  86. </view>
  87. </template>
  88. <script>
  89. import searchBox from "./components/searchBox.vue";
  90. import audioBox from './components/audioBox.vue'
  91. import sharePoster from '@/components/sharePoster/sharePoster.vue'
  92. import {apiReportList,apiSubClassifyList,apiReportClassifyMenuList} from '@/api/report'
  93. import {apiGetSceneToParams} from '@/api/common'
  94. const dayjs=require('@/utils/dayjs.min')
  95. export default {
  96. computed: {
  97. showAudioPop(){//是否显示音频弹窗
  98. return this.$store.state.report.audioData.show
  99. },
  100. curAudioReportId(){//当前播放的音频所属报告
  101. return this.$store.state.report.audioData.reportId
  102. },
  103. curAudioPaused(){//当前音频是否暂停状态
  104. return this.$store.state.report.audioData.paused
  105. },
  106. shareParams(){
  107. let obj={
  108. list_title:this.classifyName,
  109. img_1:'',
  110. title_1:'',
  111. abstract_1:'',
  112. abstract_1_style:'',
  113. time_1:'',
  114. img_2:'',
  115. title_2:'',
  116. abstract_2:'',
  117. abstract_2_style:'',
  118. time_2:'',
  119. }
  120. if(this.list[0]){
  121. obj.img_1=this.list[0].report_img_url
  122. obj.title_1=this.list[0].title
  123. obj.abstract_1=this.list[0].classify_name_second
  124. obj.time_1=this.list[0].rai_report_id===0? `${this.list[0].stage}期 | ${dayjs(this.list[0].publish_time).format('YYYY.MM.DD')}`:`${dayjs(this.list[0].publish_time).format('YYYY.MM.DD')}`
  125. obj.abstract_1_style=this.list[0].classify_name_second?'':'display:none'
  126. }
  127. if(this.list[1]){
  128. obj.img_2=this.list[1].report_img_url
  129. obj.title_2=this.list[1].title
  130. obj.abstract_2=this.list[1].classify_name_second
  131. obj.time_2=this.list[1].rai_report_id===0?`${this.list[1].stage}期 | ${dayjs(this.list[1].publish_time).format('YYYY.MM.DD')}`:`${dayjs(this.list[1].publish_time).format('YYYY.MM.DD')}`
  132. obj.abstract_2_style=this.list[1].classify_name_second?'':'display:none'
  133. }
  134. return obj
  135. },
  136. code_scene(){
  137. return JSON.stringify({classifyId:this.classifyId,classifyName:this.classifyName})
  138. }
  139. },
  140. components: {
  141. searchBox,
  142. audioBox
  143. },
  144. data() {
  145. return {
  146. classifyId:0,
  147. classifyName:'',
  148. classifyList:[],
  149. selectSecClassifyId:0,
  150. searchVal: "",
  151. showFilter:false,
  152. list:[],
  153. finished:false,
  154. page:1,
  155. pageSize:20,
  156. classifyMenuList:[],
  157. selectClassifyMenu:0,
  158. };
  159. },
  160. onLoad(options) {
  161. if(options.scene){
  162. this.init(options.scene)
  163. }else{
  164. this.classifyId=options.classifyId
  165. this.classifyName=decodeURIComponent(options.classifyName)
  166. // 设置title
  167. uni.setNavigationBarTitle({ title: decodeURIComponent(options.classifyName) })
  168. this.getList()
  169. // this.getClassifyList()
  170. this.getClassifyMenuList()
  171. }
  172. },
  173. onPullDownRefresh() {
  174. this.page=1
  175. this.list=[]
  176. this.finished=false
  177. this.getList()
  178. // this.getClassifyList()
  179. this.getClassifyMenuList()
  180. setTimeout(() => {
  181. uni.stopPullDownRefresh()
  182. }, 1500);
  183. },
  184. onReachBottom() {
  185. if(this.finished) return
  186. this.page++
  187. this.getList()
  188. },
  189. onShareAppMessage() {
  190. return {
  191. title:`FICC【${this.classifyName}】`
  192. }
  193. },
  194. methods: {
  195. async init(e){
  196. const res=await apiGetSceneToParams({scene_key:e})
  197. if(res.code==200){
  198. const obj=JSON.parse(res.data)
  199. this.classifyId=obj.classifyId
  200. this.classifyName=decodeURIComponent(obj.classifyName)
  201. uni.setNavigationBarTitle({ title: decodeURIComponent(obj.classifyName) })
  202. this.getList()
  203. // this.getClassifyList()
  204. this.getClassifyMenuList()
  205. }
  206. },
  207. //获取研报列表
  208. async getList(){
  209. const res=await apiReportList({
  210. classify_id_first:Number(this.classifyId),
  211. classify_id_second:Number(this.selectSecClassifyId),
  212. classify_menu_id:Number(this.selectClassifyMenu),
  213. key_word:this.searchVal,
  214. current_index:this.page,
  215. page_size:this.pageSize
  216. })
  217. if(res.code===200){
  218. let arr=res.data.list||[]
  219. this.list=[...this.list,...arr]
  220. if(res.data.paging.is_end){
  221. this.finished=true
  222. }
  223. }
  224. },
  225. // 获取子目录
  226. async getClassifyMenuList(){
  227. const res=await apiReportClassifyMenuList({classify_id:Number(this.classifyId)})
  228. if(res.code===200){
  229. this.classifyMenuList=res.data||[]
  230. }
  231. },
  232. handleSelectMenu(item){
  233. if(item.menu_id==this.selectClassifyMenu) return
  234. this.selectClassifyMenu=item.menu_id
  235. this.searchVal=''
  236. this.page=1
  237. this.finished=false
  238. this.list=[]
  239. this.getList()
  240. },
  241. //分类数据(需求修改 不要这种筛选了 换成后台配置的子目录去筛选)
  242. async getClassifyList(){
  243. const res=await apiSubClassifyList({classify_id_first:Number(this.classifyId)})
  244. if(res.code===200){
  245. this.classifyList=res.data
  246. }
  247. },
  248. handleSelectSecClassifyId(item){
  249. if(this.selectSecClassifyId==item.classify_id_second){
  250. this.selectSecClassifyId=''
  251. }else{
  252. this.selectSecClassifyId=item.classify_id_second
  253. }
  254. this.showFilter=false
  255. this.page=1
  256. this.finished=false
  257. this.list=[]
  258. this.getList()
  259. },
  260. onChange(e) {
  261. this.searchVal = e;
  262. },
  263. onSearch() {
  264. console.log("搜索", this.searchVal);
  265. this.page=1
  266. this.finished=false
  267. this.list=[]
  268. this.getList()
  269. },
  270. goReportDetail(item){
  271. // 权益研报
  272. if(item.rai_report_id>0){
  273. uni.navigateTo({ url: '/pages-report/raiReportDetail?reportId='+item.report_id })
  274. return
  275. }
  276. // if(['晨报','周报'].includes(item.classify_name_first)){
  277. if(item.has_chapter&&item.report_detail_show_type===2){
  278. uni.navigateTo({ url: '/pages-report/chapterList?reportId='+item.report_id })
  279. return
  280. }
  281. uni.navigateTo({ url: '/pages-report/reportDetail?reportId='+item.report_id })
  282. },
  283. handleClickAudio(item){
  284. if(!item.auth_ok) return
  285. if((!item.video_list||item.video_list.length==0)&&!item.video_url){
  286. uni.showToast({
  287. title: '暂无音频',
  288. icon: 'none'
  289. })
  290. return
  291. }
  292. // 判断是否为同一个音频
  293. if(this.$store.state.report.audioData.reportId==item.report_id){
  294. if(this.globalBgMusic.paused){
  295. this.globalBgMusic.play()
  296. this.$store.commit('showPopAudio')
  297. }else{
  298. this.globalBgMusic.pause()
  299. }
  300. }else{
  301. this.$store.commit('addAudio', {
  302. list: item.video_url
  303. ? [{ video_name: item.video_name,video_url: item.video_url,video_play_seconds: item.video_play_seconds }]
  304. : item.video_list,
  305. reportId:item.report_id
  306. })
  307. }
  308. },
  309. // 跳转搜索
  310. goSearch(){
  311. uni.navigateTo({
  312. url:`/pages-report/reportListSearch?classify_id_first=${this.classifyId}&classifyName=${this.classifyName}`
  313. })
  314. }
  315. },
  316. };
  317. </script>
  318. <style>
  319. page{
  320. padding-bottom: constant(safe-area-inset-bottom);
  321. padding-bottom: env(safe-area-inset-bottom);
  322. }
  323. </style>
  324. <style lang="scss" scoped>
  325. .top-filter-box{
  326. background-color: white;
  327. position: sticky;
  328. top: 0;
  329. left: 0;
  330. z-index: 99;
  331. .tabs-box{
  332. box-shadow: 0px 4rpx 4rpx 0px rgba(198,198,198,0.2500);
  333. overflow-x: auto;
  334. white-space: nowrap;
  335. padding: 0 34rpx 16rpx 34rpx;
  336. &::-webkit-scrollbar{
  337. width: 0;
  338. height: 0;
  339. display: none;
  340. }
  341. .sub-nav-item{
  342. display: inline-block;
  343. position: relative;
  344. margin-right: 50rpx;
  345. font-size: 28rpx;
  346. color: #666;
  347. position: relative;
  348. &.active{
  349. color: #E3B377;
  350. &::after{
  351. content: '';
  352. display: block;
  353. width: 54rpx;
  354. height: 4rpx;
  355. background-color: #E3B377;
  356. position: absolute;
  357. bottom: -16rpx;
  358. left: 50%;
  359. transform: translateX(-50%);
  360. }
  361. }
  362. }
  363. }
  364. }
  365. .search-wrap {
  366. background-color: #fff;
  367. padding: 30rpx 34rpx 16rpx 34rpx;
  368. align-items: center;
  369. .filter-box {
  370. margin-left: 20rpx;
  371. image {
  372. width: 52rpx;
  373. height: 52rpx;
  374. vertical-align: middle;
  375. }
  376. text {
  377. vertical-align: middle;
  378. color: #e3b377;
  379. font-size: 32rpx;
  380. }
  381. }
  382. }
  383. .report-list-wrap {
  384. padding: 34rpx 34rpx 0 34rpx;
  385. .item{
  386. margin-bottom: 30rpx;
  387. position: relative;
  388. .img{
  389. width: 90rpx;
  390. height: 120rpx;
  391. background-color: #f5f5f5;
  392. border-radius: 8rpx;
  393. overflow: hidden;
  394. margin-right: 19rpx;
  395. flex-shrink: 0;
  396. }
  397. .con{
  398. padding-right: 100rpx;
  399. flex: 1;
  400. }
  401. .title{
  402. font-size: 28rpx;
  403. font-weight: bold;
  404. margin-bottom: 10rpx;
  405. // min-height: 70rpx;
  406. }
  407. .abstract{
  408. /* width:100%;
  409. overflow: hidden;
  410. white-space: nowrap;
  411. text-overflow: ellipsis; */
  412. display: -webkit-box;
  413. overflow: hidden;
  414. text-overflow: ellipsis;
  415. word-break: break-all;
  416. -webkit-box-orient: vertical;
  417. -webkit-line-clamp: 1;
  418. color: #9C9791;
  419. div{
  420. color: #9C9791;
  421. }
  422. }
  423. .info{
  424. font-size: 24rpx;
  425. color: #9C9791;
  426. }
  427. .audio-box{
  428. position: absolute;
  429. top: 50%;
  430. transform: translateY(-50%);
  431. width: 22px;
  432. height: 20px;
  433. background: linear-gradient(180deg, #F3A52F 0%, #E3B377 100%);
  434. border-radius: 6px;
  435. right: 20rpx;
  436. text-align: center;
  437. image{
  438. width: 12px;
  439. height: 12px;
  440. position: relative;
  441. top: 1px;
  442. }
  443. }
  444. }
  445. }
  446. .filter-wrap{
  447. background-color: #fff;
  448. padding-top: 53rpx;
  449. .top{
  450. font-size: 32rpx;
  451. justify-content: space-between;
  452. margin-bottom: 40rpx;
  453. padding: 0 34rpx;
  454. }
  455. .list-box{
  456. min-height: 30vh;
  457. max-height: 60vh;
  458. overflow-y: auto;
  459. padding: 0 34rpx;
  460. .item{
  461. background-color: #F6F6F6;
  462. color: #000000;
  463. // text-align: center;
  464. height: 76rpx;
  465. overflow: hidden;
  466. display: flex;
  467. align-items: center;
  468. justify-content: center;
  469. // line-height: 76rpx;
  470. margin-bottom: 20rpx;
  471. }
  472. .active{
  473. background-color: #FAEEDE;
  474. }
  475. }
  476. }
  477. </style>