reportList.vue 13 KB

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