detail.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. <template>
  2. <view class="special-column-info-page">
  3. <image class="top-bg" src="../static/bg-1.png" mode="aspectFill"/>
  4. <view class="user-wrap" v-if="info">
  5. <image :src="info.avatar_img_url" mode="aspectFill" class="avatar"/>
  6. <view class="user-name">
  7. <text>{{info.report_author}}</text>
  8. <text class="tag" v-if="info.vip_title">{{info.vip_title}}</text>
  9. </view>
  10. <view class="user-intro">{{info.author_descript}}</view>
  11. </view>
  12. <van-sticky>
  13. <view class="flex tab-box">
  14. <view :class="['item',tabActive=='专栏介绍'&&'tab-acitve']" @click="tabChange('专栏介绍')">专栏介绍</view>
  15. <view :class="['item',tabActive=='报告目录'&&'tab-acitve']" @click="tabChange('报告目录')">报告目录</view>
  16. </view>
  17. </van-sticky>
  18. <view class="section column-intro-wrap" v-if="tabActive=='专栏介绍'">
  19. <view v-html="info.abstract"></view>
  20. </view>
  21. <view class="section report-list-wrap" v-if="tabActive=='报告目录'">
  22. <view class="report-empty-box" v-if="finished&&list.length==0">
  23. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  24. <view>暂无报告</view>
  25. </view>
  26. <block v-else>
  27. <view class="flex item" v-for="item in list" :key="item" @click="goDetail(item)">
  28. <image class="img" :src="item.report_img_url" mode="aspectFill" lazy-load/>
  29. <view class="con">
  30. <view class="title">{{formatTitle(item)}}</view>
  31. <view class="time">{{item.publish_time|formatReportTime}}</view>
  32. <view v-if="info.auth_ok" :class="['audio-box',!info.auth_ok&&'grey-audio-box']" @click.stop="handleClickAudio(item)">
  33. <image :src="curAudioReportId==item.report_id&&!curAudioPaused?'../static/audio-s.png':'../static/audio.png'" mode="aspectFill"/>
  34. <text>{{curAudioReportId==item.report_id&&!curAudioPaused?'暂停':'播放'}}</text>
  35. </view>
  36. </view>
  37. </view>
  38. </block>
  39. </view>
  40. <view class="contact-box" v-if="info&&!info.auth_ok&&!info.permission_check.mobile" @click="handleContact">联系我们</view>
  41. <!-- 音频弹窗 -->
  42. <audioBox v-if="showAudioPop"></audioBox>
  43. <!-- 分享海报 -->
  44. <sharePoster
  45. :style="{bottom:'190rpx'}"
  46. :shareData="{
  47. type:'special_column_detail',
  48. code_page:'pages-report/specialColumn/detail',
  49. code_scene:code_scene,
  50. data:shareParams
  51. }"
  52. ></sharePoster>
  53. </view>
  54. </template>
  55. <script>
  56. import {apiSpecialColumnDetail,apiSpecialColumnReportList} from '@/api/report'
  57. import {apiGetSceneToParams} from '@/api/common'
  58. import audioBox from '../components/audioBox.vue'
  59. import sharePoster from '@/components/sharePoster/sharePoster.vue'
  60. const dayjs=require('@/utils/dayjs.min')
  61. export default {
  62. computed: {
  63. showAudioPop(){//是否显示音频弹窗
  64. return this.$store.state.report.audioData.show
  65. },
  66. curAudioReportId(){//当前播放的音频所属报告
  67. return this.$store.state.report.audioData.reportId
  68. },
  69. curAudioPaused(){//当前音频是否暂停状态
  70. return this.$store.state.report.audioData.paused
  71. },
  72. shareParams(){
  73. if(this.info){
  74. let obj={
  75. report_avatar:this.info.avatar_img_url,
  76. report_title:this.info.classify_name_second,
  77. report_abstract:this.info.abstract
  78. }
  79. return obj
  80. }
  81. },
  82. code_scene(){
  83. return JSON.stringify({columnId:this.columnId})
  84. }
  85. },
  86. components: {
  87. audioBox,
  88. sharePoster
  89. },
  90. data () {
  91. return {
  92. tabActive:'专栏介绍',
  93. columnId:0,
  94. info:null,
  95. list:[],
  96. page:1,
  97. pageSize:20,
  98. finished:false
  99. }
  100. },
  101. onLoad(options) {
  102. if(options.scene){
  103. this.init(options.scene)
  104. }else{
  105. this.columnId=options.columnId
  106. this.getDetail()
  107. this.getList()
  108. }
  109. },
  110. onPullDownRefresh() {
  111. this.getDetail()
  112. this.list=[]
  113. this.page=1
  114. this.finished=false
  115. this.getList()
  116. setTimeout(()=>{
  117. uni.stopPullDownRefresh()
  118. },1500)
  119. },
  120. onReachBottom() {
  121. if(!this.finished&&this.tabActive=='报告目录'){
  122. this.page++
  123. this.getList()
  124. }
  125. },
  126. onShareAppMessage() {
  127. return {
  128. title:`FICC【${this.info.classify_name_second}】`
  129. }
  130. },
  131. methods: {
  132. async init(e){
  133. const res=await apiGetSceneToParams({scene_key:e})
  134. if(res.code==200){
  135. const obj=JSON.parse(res.data)
  136. this.columnId=obj.columnId
  137. this.getDetail()
  138. this.getList()
  139. }
  140. },
  141. async getDetail(){
  142. const res=await apiSpecialColumnDetail({classify_id_second:Number(this.columnId)})
  143. if(res.code===200){
  144. this.info=res.data
  145. uni.setNavigationBarTitle({ title: res.data.classify_name_second })
  146. }
  147. },
  148. async getList(){
  149. const res=await apiSpecialColumnReportList({
  150. classify_id_second:Number(this.columnId),
  151. current_index:this.page,
  152. page_size:this.pageSize
  153. })
  154. if(res.code===200){
  155. let arr=res.data.list||[]
  156. this.list=[...this.list,...arr]
  157. if(res.data.paging.is_end){
  158. this.finished=true
  159. }
  160. }
  161. },
  162. tabChange(e){
  163. this.tabActive=e
  164. },
  165. goDetail(item){
  166. uni.navigateTo({ url: '/pages-report/reportDetail?reportId='+item.report_id })
  167. },
  168. handleContact(){
  169. uni.makePhoneCall({
  170. phoneNumber: this.info.permission_check.hz_phone
  171. })
  172. },
  173. handleClickAudio(item){
  174. if(!this.info.auth_ok) return
  175. if(!item.video_url){
  176. uni.showToast({
  177. title: '暂无音频',
  178. icon: 'none'
  179. })
  180. return
  181. }
  182. // 判断是否为同一个音频
  183. if(this.$store.state.report.audioData.reportId==item.report_id){
  184. if(this.globalBgMusic.paused){
  185. this.globalBgMusic.play()
  186. this.$store.commit('showPopAudio')
  187. }else{
  188. this.globalBgMusic.pause()
  189. }
  190. }else{
  191. this.$store.commit('addAudio', {
  192. list:[{
  193. video_url:item.video_url,
  194. video_name:item.video_name,
  195. video_play_seconds:item.video_play_seconds,
  196. video_img:item.report_img_url
  197. }],
  198. reportId:item.report_id
  199. })
  200. }
  201. },
  202. formatTitle(item){
  203. let t=dayjs(item.publish_time).format('MMDD')
  204. return `【第${item.stage}期】${item.classify_name_second}(${t})`
  205. }
  206. }
  207. }
  208. </script>
  209. <style lang="scss">
  210. page{
  211. padding-bottom: 0;
  212. }
  213. </style>
  214. <style lang="scss" scoped>
  215. .special-column-info-page{
  216. .top-bg{
  217. display: block;
  218. width: 100%;
  219. height: 188rpx;
  220. }
  221. .user-wrap{
  222. padding: 0 34rpx;
  223. margin-bottom: 34rpx;
  224. .avatar{
  225. width: 140rpx;
  226. height: 140rpx;
  227. background-color: #f5f5f5;
  228. display: block;
  229. box-sizing: border-box;
  230. border: 4rpx solid #fff;
  231. border-radius: 50%;
  232. margin-top: -70rpx;
  233. }
  234. .user-name{
  235. margin-top: 20rpx;
  236. text:first-child{
  237. font-size: 32rpx;
  238. font-weight: bold;
  239. }
  240. .tag{
  241. background-color: #FAF7EE;
  242. margin-left: 20rpx;
  243. padding: 6rpx 16rpx;
  244. border-radius: 30rpx;
  245. font-size: 24rpx;
  246. display: inline-block;
  247. &::before{
  248. content: '';
  249. display: inline-block;
  250. width: 30rpx;
  251. height: 30rpx;
  252. background-image: url('../static/tag.png');
  253. background-size: cover;
  254. position: relative;
  255. top: 4rpx;
  256. }
  257. }
  258. }
  259. .user-title{
  260. color: #666666;
  261. margin: 20rpx 0;
  262. }
  263. .user-intro{
  264. margin-top: 20rpx;
  265. font-size: 24rpx;
  266. color: #666666;
  267. line-height: 1.7;
  268. }
  269. }
  270. .tab-box{
  271. align-items: center;
  272. height: 78rpx;
  273. background: #FFFFFF;
  274. position: relative;
  275. box-shadow: 0px 4rpx 4rpx 1px rgba(198, 198, 198, 0.16);
  276. .item{
  277. flex: 1;
  278. text-align: center;
  279. font-size: 32rpx;
  280. }
  281. &::after{
  282. content: '';
  283. position: absolute;
  284. display: inline-block;
  285. width: 1rpx;
  286. height: 78rpx;
  287. top: 0;
  288. left: 50%;
  289. background-color: #F6F6F6;
  290. }
  291. .tab-acitve{
  292. color: #E3B377;
  293. }
  294. }
  295. .section{
  296. padding: 34rpx;
  297. padding-top: 60rpx;
  298. line-height: 1.7;
  299. color: #666666;
  300. padding-bottom: 90rpx;
  301. }
  302. .report-list-wrap{
  303. .item{
  304. margin-bottom: 30rpx;
  305. padding-bottom: 30rpx;
  306. border-bottom: 1px solid #EDEDED;
  307. .img{
  308. width: 118rpx;
  309. height: 118rpx;
  310. border-radius: 50%;
  311. background-color: #f5f5f5;
  312. flex-shrink: 0;
  313. margin-right: 12rpx;
  314. }
  315. .con{
  316. flex: 1;
  317. position: relative;
  318. overflow: hidden;
  319. line-height: 1;
  320. .title{
  321. font-size: 32rpx;
  322. font-weight: bold;
  323. margin-bottom: 8rpx;
  324. padding-top: 10rpx;
  325. color: #333;
  326. }
  327. .time{
  328. position: absolute;
  329. bottom: 0;
  330. left: 14rpx;
  331. line-height: 1.7;
  332. color: #666666;
  333. }
  334. .audio-box{
  335. position: absolute;
  336. bottom: 0;
  337. right: 0;
  338. width: 99rpx;
  339. height: 39rpx;
  340. background: #E3B377;
  341. border-radius: 20rpx;
  342. color: #fff;
  343. font-size: 24rpx;
  344. display: flex;
  345. justify-content: center;
  346. align-items: center;
  347. image{
  348. width: 30rpx;
  349. height: 30rpx;
  350. margin-right: 4rpx;
  351. }
  352. }
  353. .grey-audio-box{
  354. background: linear-gradient(114deg, #B0B0B0 0%, #E5E2E2 100%);
  355. }
  356. }
  357. }
  358. }
  359. .contact-box{
  360. position: fixed;
  361. bottom: 0;
  362. left: 0;
  363. right: 0;
  364. height: 80rpx;
  365. background: #E6B77D;
  366. line-height: 80rpx;
  367. text-align: center;
  368. color: #FFFFFF;
  369. font-size: 32rpx;
  370. z-index: 10;
  371. }
  372. }
  373. </style>