Detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. <script setup>
  2. import {onActivated, reactive, ref} from 'vue'
  3. import moment from 'moment';
  4. import SelfList from '@/components/SelfList.vue'
  5. import {apiSpecialColumnDetail,apiSpecialColumnReportList,apiSpecialColumnComment} from '@/api/report'
  6. import { useRoute, useRouter } from 'vue-router';
  7. import { useStore } from 'vuex';
  8. const route=useRoute()
  9. const router=useRouter()
  10. const store=useStore()
  11. let nav=ref('专栏介绍')
  12. let classify_id_second=ref(route.query.columnId||0)
  13. // 向小程序发送数据
  14. const handleDataToXcx=(classifyName)=>{
  15. const postData={
  16. path:'/pages-report/specialColumn/detail',
  17. params:{
  18. columnId:classify_id_second.value
  19. },
  20. title:`FICC【${classifyName}】`,
  21. shareImg:''
  22. }
  23. wx.miniProgram.postMessage({ data: postData })
  24. }
  25. let info=ref(null)//专栏详情
  26. const getSpecialColumnDetail=async ()=>{
  27. const res=await apiSpecialColumnDetail({classify_id_second:Number(classify_id_second.value)})
  28. if(res.code===200){
  29. info.value=res.data
  30. document.title=res.data.classify_name_second
  31. store.commit('modifyBreadCrumb',res.data.classify_name_second)
  32. handleDataToXcx(res.data.classify_name_second)
  33. }
  34. }
  35. getSpecialColumnDetail()
  36. // 客户评价
  37. let commentList=ref([])
  38. const getComment=async ()=>{
  39. const res=await apiSpecialColumnComment({classify_id_second:Number(classify_id_second.value)})
  40. if(res.code===200){
  41. commentList.value=res.data
  42. }
  43. }
  44. getComment()
  45. // 获取报告列表
  46. let listState=reactive({
  47. list:[],
  48. page:1,
  49. pageSize:20,
  50. finished:false,
  51. loading:false
  52. })
  53. const getReportList=async ()=>{
  54. listState.loading=true
  55. const res=await apiSpecialColumnReportList({
  56. classify_id_second:Number(classify_id_second.value),
  57. current_index:listState.page,
  58. page_size:listState.pageSize
  59. })
  60. listState.loading=false
  61. if(res.code===200){
  62. let arr=res.data.list||[]
  63. listState.list=[...listState.list,...arr]
  64. if(res.data.paging.is_end){
  65. listState.finished=true
  66. }
  67. }
  68. }
  69. getReportList()
  70. // 加载更多
  71. const onLoad=()=>{
  72. listState.page++
  73. getReportList()
  74. }
  75. //跳转报告详情
  76. const goReportDetail=(item)=>{
  77. router.push({
  78. path:'/report/detail',
  79. query:{
  80. reportId:item.report_id
  81. }
  82. })
  83. }
  84. //播放音频
  85. const handlePlayAudio=(item)=>{
  86. if(store.state.audioData.reportId==item.report_id){
  87. if(store.state.audioData.paused){
  88. store.state.audioData.INS.play()
  89. }else{
  90. store.state.audioData.INS.pause()
  91. }
  92. return
  93. }
  94. store.commit('addAudio',{
  95. list:[{name:item.video_name,url:item.video_url,time:item.video_play_seconds}],
  96. reportId:item.report_id,
  97. index:0
  98. })
  99. }
  100. // 组件激活时
  101. onActivated(()=>{
  102. const temClassify_id_second=route.query.columnId
  103. if(temClassify_id_second!=classify_id_second.value){
  104. nav.value='专栏介绍'
  105. classify_id_second.value=temClassify_id_second
  106. listState.list=[]
  107. listState.page=1
  108. listState.finished=false
  109. getSpecialColumnDetail()
  110. getReportList()
  111. }else{
  112. if(info.value){
  113. handleDataToXcx(info.value.classify_name_second)
  114. }
  115. }
  116. })
  117. </script>
  118. <template>
  119. <div class="specialColumn-detail-page" v-if="info">
  120. <div class="top-user-box" >
  121. <div class="title">{{info.classify_name_second}}</div>
  122. <div class="flex-col-center">
  123. <img class="avatar" :src="info.avatar_img_url" alt="">
  124. <div>
  125. <div>
  126. <span class="name">{{info.report_author}}</span>
  127. <span class="vip" v-if="info.vip_title">{{info.vip_title}}</span>
  128. </div>
  129. <p>{{info.author_descript}}</p>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="main-box">
  134. <div class="nav-box">
  135. <span :class="nav==='专栏介绍'&&'active'" @click="nav='专栏介绍'">专栏介绍</span>
  136. <span :class="nav==='专栏目录'&&'active'" @click="nav='专栏目录'">专栏目录</span>
  137. <span :class="nav==='客户评价'&&'active'" @click="nav='客户评价'">客户评价</span>
  138. </div>
  139. <!-- 专栏介绍模块 -->
  140. <div class="introduce-wrap" v-if="nav==='专栏介绍'">
  141. <p>{{info.abstract}}</p>
  142. </div>
  143. <!-- 专栏报告模块 -->
  144. <template v-if="nav==='专栏目录'">
  145. <SelfList
  146. :finished="listState.finished"
  147. :isEmpty="listState.list.length === 0 && listState.finished"
  148. :loading="listState.loading"
  149. @listOnload="onLoad"
  150. >
  151. <div class="report-list">
  152. <div
  153. class="flex item"
  154. v-for="item in listState.list"
  155. :key="item.report_id"
  156. @click="goReportDetail(item)"
  157. >
  158. <div class="user-box">
  159. <img class="avatar" :src="item.report_img_url" alt="">
  160. <div>
  161. <span>{{item.author}}</span>
  162. <img src="@/assets/tag.png" alt="">
  163. </div>
  164. </div>
  165. <div class="con">
  166. <span class="title">【第{{item.stage}}期|FICC】{{item.classify_name_second}}</span>
  167. <div class="des" v-html="item.abstract"></div>
  168. <div class="time">{{moment(item.publish_time).format('YYYY.MM.DD HH:mm')}}</div>
  169. </div>
  170. <div
  171. class="global-plain-btn audio-btn"
  172. @click.stop="handlePlayAudio(item)"
  173. >{{$store.state.audioData.reportId==item.report_id?$store.state.audioData.paused?'已暂停':'播放中':'立即播放'}}</div>
  174. </div>
  175. </div>
  176. </SelfList>
  177. </template>
  178. <!-- 客户评价模块 -->
  179. <template v-if="nav==='客户评价'">
  180. <div class="comment-list-wrap">
  181. <div class="comment-item" v-for="item in commentList" :key="item.Id">
  182. <div class="flex top">
  183. <img class="avatar" :src="item.HeadImgUrl" alt="">
  184. <span>{{item.CompanyName}}</span>
  185. </div>
  186. <p class="des" v-html="item.Comment"></p>
  187. </div>
  188. </div>
  189. </template>
  190. </div>
  191. </div>
  192. </template>
  193. <style lang="scss" scoped>
  194. .specialColumn-detail-page{
  195. .top-user-box{
  196. height: 230px;
  197. background-image: url('@/assets/bg-1.png');
  198. background-size: cover;
  199. background-repeat: no-repeat;
  200. padding-top: 40px;
  201. padding-left: 75px;
  202. .title{
  203. font-size: 32px;
  204. font-weight: bold;
  205. margin-bottom: 18px;
  206. }
  207. .avatar{
  208. width: 90px;
  209. height: 90px;
  210. border-radius: 50%;
  211. object-fit: cover;
  212. margin-right: 13px;
  213. flex-shrink: 0;
  214. }
  215. .name{
  216. font-size: 20px;
  217. font-weight: bold;
  218. margin-right: 10px;
  219. }
  220. .vip{
  221. background-color: #FAF7EE;
  222. font-size: 14px;
  223. height: 24px;
  224. line-height: 24px;
  225. padding: 0 10px;
  226. border-radius: 23px;
  227. &::before{
  228. content: '';
  229. display: inline-block;
  230. width: 15px;
  231. height: 15px;
  232. background-image: url('@/assets/tag.png');
  233. background-size: cover;
  234. position: relative;
  235. top: 2px;
  236. margin-right: 3px;
  237. }
  238. }
  239. }
  240. .main-box{
  241. .nav-box{
  242. padding-top: 60px;
  243. padding-bottom: 10px;
  244. background-color: #fff;
  245. span{
  246. font-size: 18px;
  247. position: relative;
  248. margin-right: 60px;
  249. &:hover{
  250. color: #F3A52F;
  251. }
  252. }
  253. .active{
  254. color: #F3A52F;
  255. &::after{
  256. content: '';
  257. display: block;
  258. width: 40px;
  259. height: 4px;
  260. background: #F3A52F;
  261. border-radius: 2px;
  262. position: absolute;
  263. top: 105%;
  264. left: 50%;
  265. transform: translateX(-50%);
  266. }
  267. }
  268. }
  269. .introduce-wrap{
  270. font-size: 18px;
  271. color: #666;
  272. line-height: 34px;
  273. }
  274. .report-list{
  275. .item{
  276. padding-top: 20px;
  277. padding-bottom: 30px;
  278. padding-left: 16px;
  279. padding-right: 16px;
  280. border-bottom: 1px solid #F2F2F2;
  281. position: relative;
  282. .user-box{
  283. flex-shrink: 0;
  284. .avatar{
  285. width: 64px;
  286. height: 64px;
  287. border-radius: 50%;
  288. object-fit: cover;
  289. display: block;
  290. margin: 0 auto;
  291. }
  292. div{
  293. margin-top: 7px;
  294. margin-left: auto;
  295. margin-right: auto;
  296. width: 96px;
  297. height: 28px;
  298. line-height: 28px;
  299. background: #FFFBF5;
  300. border-radius: 4px;
  301. text-align: center;
  302. font-size: 14px;
  303. color: #F3A52F;
  304. img{
  305. width: 16px;
  306. height: 16px;
  307. position: relative;
  308. top: 2px;
  309. }
  310. }
  311. }
  312. .con{
  313. display: flex;
  314. flex-direction: column;
  315. justify-content: space-between;
  316. margin-left: 40px;
  317. flex: 1;
  318. color: #000;
  319. .title{
  320. font-size: 20px;
  321. margin-left: -8px;
  322. }
  323. }
  324. .audio-btn{
  325. position: absolute;
  326. bottom: 30px;
  327. right: 16px;
  328. width: 100px;
  329. font-size: 14px;
  330. height: 30px;
  331. line-height: 30px;
  332. padding-top: 0;
  333. padding-bottom: 0;
  334. }
  335. }
  336. }
  337. .comment-list-wrap{
  338. display: flex;
  339. flex-wrap: wrap;
  340. .comment-item{
  341. width: 50%;
  342. padding-top: 20px;
  343. padding-bottom: 20px;
  344. border-bottom: 1px solid #F2F2F2;
  345. &:nth-child(odd){
  346. border-right: 1px solid #F2F2F2;
  347. padding-right: 20px;
  348. }
  349. &:nth-child(even){
  350. padding-left: 20px;
  351. }
  352. .top{
  353. align-items: center;
  354. .avatar{
  355. width: 40px;
  356. height: 40px;
  357. border-radius: 50%;
  358. object-fit: cover;
  359. margin-right: 7px;
  360. }
  361. span{
  362. font-size: 16px;
  363. color: #F3A52F;
  364. }
  365. }
  366. .des{
  367. margin-top: 8px;
  368. font-size: 14px;
  369. line-height: 26px;
  370. }
  371. }
  372. }
  373. }
  374. }
  375. </style>