reportList.vue 14 KB

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