report.vue 14 KB

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