detail.vue 12 KB

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