report.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <template>
  2. <view class="report-page">
  3. <view class="top-sticky" style="background: #fff">
  4. <!-- 导航 -->
  5. <view class="nav-bar-wrap" :style="{height:navBarStyle.height,paddingTop:navBarStyle.paddingTop,paddingBottom:navBarStyle.paddingBottom}">
  6. <view class="content">
  7. <van-icon custom-class="search-icon" name="search" size="24px" @click="goSearch" />
  8. <view class="text">FICC研报</view>
  9. </view>
  10. </view>
  11. <!-- 分类 -->
  12. <view class="type-wrap">
  13. <view class="flex first-type-box">
  14. <view class="item" v-for="(item,index) in topFirstList" :key="item.classify_name" @click="handleClickTopFirst(item,index)">
  15. <image :src="selectTopFirstId==item.classify_name?item.select_icon_url:item.icon_url" mode="aspectFill"/>
  16. <view>{{item.classify_name}}</view>
  17. </view>
  18. <!-- <view class="item" @click="goClassify">
  19. <image src="@/static/report-menu.png" mode="aspectFill"/>
  20. <view>查看更多</view>
  21. </view> -->
  22. </view>
  23. <view class="flex sub-type-box">
  24. <view
  25. :class="['item',item.chart_permission_id==selectTopSubId&&'active']"
  26. v-for="item in topSubList" :key="item.chart_permission_id"
  27. @click="handleClickTopSub(item)"
  28. >{{item.chart_permission_name}}</view>
  29. </view>
  30. </view>
  31. </view>
  32. <view class="report-empty-box" v-if="finished&&list.length==0">
  33. <image :src="globalImgUrls.chartEmpty" mode="widthFix" />
  34. <view>暂无报告</view>
  35. </view>
  36. <view class="list-wrap" v-else>
  37. <view class="list-item" v-for="item in list" :key="item.date">
  38. <view class="time">{{getReportListDate(item.date)}}</view>
  39. <view class="content-list">
  40. <view class="content-item" v-for="citem in item.sub_list" :key="citem.report_id">
  41. <view class="content-box" @click="goDetail(citem)">
  42. <view class="all-btn">全部</view>
  43. <view class="c-time">{{citem.publish_time|getListTime}}</view>
  44. <view class="c-title">{{citem.title}}</view>
  45. <view class="desc" v-html="citem.content_sub"></view>
  46. <view class="tags">
  47. <text style="margin-right:15px" v-if="citem.classify_name_first">#{{citem.classify_name_first}}</text>
  48. <text style="margin-right:15px" v-if="citem.classify_name_second">#{{citem.classify_name_second}}</text>
  49. </view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 联系销售弹窗 -->
  56. <van-popup :show="authData.show" @close="authData.show=false" :close-on-click-overlay="false">
  57. <view class="global-pup">
  58. <view class="content">
  59. <view style="width:100%">
  60. <view>您暂无该品种权限,若想查看请联系</view>
  61. <view>对口销售{{authData.contactInfo.name}}:{{authData.contactInfo.mobile}}</view>
  62. </view>
  63. </view>
  64. <view class="flex bot">
  65. <view @click="authData.show=false" style="color:#A9AFB8">取消</view>
  66. <view @click="handleCallPhone(authData.contactInfo.mobile)">拨号</view>
  67. </view>
  68. </view>
  69. </van-popup>
  70. </view>
  71. </template>
  72. <script>
  73. const moment=require('@/utils/moment-with-locales.min')
  74. moment.locale('zh-cn');
  75. import {apiReportIndexPageAuthList,apiReportIndexPageList} from '@/api/report'
  76. export default {
  77. filters: {
  78. getListTime(e){
  79. return moment(e).format('HH:mm:ss')
  80. }
  81. },
  82. data () {
  83. return {
  84. navBarStyle:{
  85. height:60+'px',
  86. paddingTop:40+'px',
  87. paddingBottom:'4px'
  88. },
  89. authData:{
  90. show:false,
  91. isBuy:false,//是否为已购客户
  92. contactInfo:''
  93. },//如果是已购客户 并且点击了没有开通的品种则弹窗联系销售
  94. topFirstList:[],
  95. selectTopFirstId:0,
  96. topSubList:[],
  97. selectTopSubId:0,
  98. list:[],
  99. dateArr:[],
  100. page:1,
  101. pageSize:20,
  102. finished:false
  103. }
  104. },
  105. onLoad(){
  106. this.initNavBar()
  107. this.getTopAuthList()
  108. },
  109. onShow() {
  110. uni.getSystemInfo({
  111. success: function (res) {
  112. if (res.windowWidth > 600||['windows','mac'].includes(res.platform)) {
  113. console.log('跳转启动页判断进入pc');
  114. uni.reLaunch({
  115. url: "/pages/pc",
  116. });
  117. }
  118. },
  119. })
  120. },
  121. onPullDownRefresh() {
  122. this.getTopAuthList()
  123. setTimeout(() => {
  124. uni.stopPullDownRefresh()
  125. }, 1500);
  126. },
  127. onReachBottom() {
  128. if(this.finished) return
  129. this.page++
  130. this.getReportList()
  131. },
  132. onShareAppMessage() {
  133. return {
  134. title:"FICC研报"
  135. }
  136. },
  137. methods: {
  138. initNavBar(){
  139. let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
  140. this.navBarStyle={
  141. height:(menuButtonInfo.height+menuButtonInfo.top+8)+'px',
  142. paddingTop:(menuButtonInfo.top-4)+'px',
  143. paddingBottom:'4px'
  144. }
  145. },
  146. //顶部权限数据
  147. async getTopAuthList(){
  148. const res=await apiReportIndexPageAuthList()
  149. if(res.code===200){
  150. this.authData.isBuy=res.data.check_flag
  151. this.authData.contactInfo=res.data.contact_info
  152. this.topFirstList=res.data.permission_list
  153. this.handleClickTopFirst(this.topFirstList[0],0)
  154. }
  155. },
  156. //点击顶部一级分类
  157. handleClickTopFirst(item,index){
  158. if(item.sort==100000){
  159. this.goClassify()
  160. return
  161. }
  162. this.selectTopFirstId=item.classify_name
  163. this.topSubList=this.topFirstList[index].list
  164. this.handleClickTopSub(this.topSubList[0])
  165. this.handleShowAuthData(this.topSubList[0])
  166. },
  167. //点击顶部二级分类
  168. handleClickTopSub(item){
  169. this.selectTopSubId=item.chart_permission_id
  170. this.list=[]
  171. this.dateArr=[]
  172. this.page=1
  173. this.finished=false
  174. this.getReportList()
  175. this.handleShowAuthData(item)
  176. },
  177. // 判断是否要为已购用户且点击的品种没有权限
  178. handleShowAuthData(e){
  179. if(this.authData.isBuy){
  180. if(!e.auth_ok){
  181. this.authData.show=true
  182. }
  183. }
  184. },
  185. //获取报告列表
  186. async getReportList(){
  187. const res=await apiReportIndexPageList({
  188. chart_permission_id:this.selectTopSubId,
  189. current_index:this.page,
  190. page_size:this.pageSize
  191. })
  192. if(res.code===200){
  193. if(res.data.list){
  194. if(this.list.length==0){
  195. this.list=res.data.list
  196. res.data.list.forEach(item=>{
  197. this.dateArr.push(item.date)
  198. })
  199. }else{
  200. //判断是否前面已经有相同日期数据 有的话添加合并
  201. let arr=[]
  202. let temTimearr=[]
  203. res.data.list.forEach(item => {
  204. if(this.dateArr.includes(item.date)){
  205. this.list.forEach(_item=>{
  206. if(item.date===_item.date){
  207. _item.sub_list=[..._item.sub_list,...item.sub_list]
  208. }
  209. })
  210. }else{
  211. arr.push(item)
  212. temTimearr.push(item.date)
  213. }
  214. });
  215. this.list=[...this.list,...arr]
  216. this.dateArr=[...this.dateArr,...temTimearr]
  217. }
  218. }
  219. if(res.data.paging.is_end){
  220. this.finished=true
  221. }
  222. }
  223. },
  224. // 跳转分类
  225. goClassify(){
  226. uni.navigateTo({ url: '/pages-report/classify' })
  227. },
  228. //跳转搜索
  229. goSearch(){
  230. uni.navigateTo({url:'/pages-report/search'})
  231. },
  232. //跳转报告详情
  233. goDetail(item){
  234. if(['晨报','周报'].includes(item.classify_name_first)){
  235. uni.navigateTo({url: `/pages-report/chapterDetail?chapterId=${item.report_chapter_id}&fromPage=home`})
  236. }else{
  237. uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.report_id})
  238. }
  239. },
  240. // 拨打电话
  241. handleCallPhone(tel){
  242. uni.makePhoneCall({
  243. phoneNumber: tel,
  244. success:()=>{
  245. this.authData.show=false
  246. }
  247. });
  248. },
  249. //设置列表日期显示
  250. getReportListDate(e){
  251. const isSameYear=moment(e).isSame(new Date(), 'year');
  252. if(isSameYear){//今年
  253. return moment(e).format('MM.DD')+' '+ moment(e).format('ddd')
  254. }else{
  255. return moment(e).format('YY.MM.DD')+' '+moment(e).format('ddd')
  256. }
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss">
  262. .van-sticky-wrap--fixed{
  263. background-color: #fff;
  264. }
  265. .nav-bar-wrap{
  266. .content{
  267. position: relative;
  268. height: 100%;
  269. .search-icon{
  270. position: absolute;
  271. left: 34rpx;
  272. top: 50%;
  273. transform: translateY(-50%);
  274. }
  275. }
  276. }
  277. </style>
  278. <style lang="scss" scoped>
  279. .top-sticky{
  280. position: sticky;
  281. top: 0;
  282. left: 0;
  283. z-index: 99;
  284. }
  285. .nav-bar-wrap{
  286. border-bottom: 1px solid $global-border-color;
  287. .content{
  288. .text{
  289. text-align: center;
  290. width: 50vw;
  291. position: absolute;
  292. left: 50%;
  293. top: 50%;
  294. transform: translate(-50%,-50%);
  295. font-weight: bold;
  296. font-size: 16px;
  297. }
  298. }
  299. }
  300. .type-wrap{
  301. // border-bottom: 1px solid $global-border-color;
  302. padding: 20rpx 34rpx 0 34rpx;
  303. box-shadow: 0px 4rpx 4rpx 1px rgba(198, 198, 198, 0.25);
  304. .first-type-box{
  305. justify-content: space-between;
  306. .item{
  307. flex-shrink: 0;
  308. text-align: center;
  309. font-size: $global-font-size-sm;
  310. image{
  311. width: 100rpx;
  312. height: 100rpx;
  313. display: block;
  314. margin: 0 auto 15rpx auto;
  315. }
  316. }
  317. }
  318. .sub-type-box{
  319. margin-top: 40rpx;
  320. font-size: 28rpx;
  321. color: #666666;
  322. overflow-x: auto;
  323. &::-webkit-scrollbar{
  324. width: 0;
  325. height: 0;
  326. display: none;
  327. }
  328. .item{
  329. padding-bottom: 16rpx;
  330. margin-right: 50rpx;
  331. flex-shrink: 0;
  332. }
  333. .active{
  334. color: #E3B377;
  335. border-bottom: 2px solid #E3B377;
  336. }
  337. }
  338. }
  339. .list-wrap{
  340. padding: 20rpx 34rpx;
  341. .list-item{
  342. margin-bottom: 40rpx;
  343. .time{
  344. margin-bottom: 32rpx;
  345. }
  346. }
  347. .content-list{
  348. .content-box{
  349. padding: 0 0rpx 20rpx 20rpx;
  350. position: relative;
  351. .all-btn{
  352. position: absolute;
  353. right: 20rpx;
  354. bottom: 20rpx;
  355. width: 95rpx;
  356. height: 34rpx;
  357. background: linear-gradient(100deg, #E3B377 0%, #FFDDB1 100%);
  358. border-radius: 17rpx;
  359. color: #fff;
  360. font-size: 24rpx;
  361. text-align: center;
  362. }
  363. }
  364. .content-item{
  365. padding:0 0 50rpx 20rpx;
  366. border-left: 1px solid #F4E1C9;
  367. position: relative;
  368. &:last-child{
  369. border-bottom: none;
  370. padding-bottom: 0rpx;
  371. }
  372. &::before{
  373. content: '';
  374. display: block;
  375. box-sizing: border-box;
  376. width: 24rpx;
  377. height: 24rpx;
  378. border-radius: 50%;
  379. border: 6rpx solid #F4E1C9;
  380. position: absolute;
  381. left: 0;
  382. top: 0;
  383. background: #E3B377;
  384. transform: translate(-50%,-50%);
  385. z-index: 2;
  386. }
  387. &::after{
  388. content:'';
  389. display: block;
  390. width: 34rpx;
  391. height: 1rpx;
  392. background-color: #F4E1C9;
  393. position: absolute;
  394. top: 0;
  395. left: 0;
  396. z-index: 1;
  397. }
  398. .c-time{
  399. position: relative;
  400. top: -17rpx;
  401. font-size: 24rpx;
  402. color: #333333;
  403. }
  404. .c-title{
  405. font-size: $global-font-size-lg;
  406. font-weight: bold;
  407. word-wrap: break-word;
  408. white-space: normal;
  409. word-break: break-all;
  410. }
  411. .desc{
  412. line-height: 1.5;
  413. margin-top: 10rpx;
  414. color: #666666;
  415. }
  416. .tags{
  417. margin-top: 20rpx;
  418. color: #E3B377;
  419. min-height: 40rpx;
  420. }
  421. }
  422. }
  423. }
  424. </style>