report.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  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().getTime()" 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. ['buy','/pages/buy/buy'],
  118. ['sandbox','/pages-sandTable/sandTable'],
  119. ['activity','/pages/activity/activity']
  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 > 600||['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. goUser(){
  273. uni.navigateTo({
  274. url: '/pages/user/user',
  275. fail () {
  276. uni.switchTab({
  277. url:'/pages/user/user',
  278. })
  279. }
  280. })
  281. },
  282. //跳转报告详情
  283. goDetail(item){
  284. if(['晨报','周报'].includes(item.classify_name_first)){
  285. uni.navigateTo({url: `/pages-report/chapterDetail?chapterId=${item.report_chapter_id}&fromPage=home`})
  286. }else{
  287. uni.navigateTo({url:'/pages-report/reportDetail?reportId='+item.report_id})
  288. }
  289. },
  290. // 拨打电话
  291. handleCallPhone(tel){
  292. uni.makePhoneCall({
  293. phoneNumber: tel,
  294. success:()=>{
  295. this.authData.show=false
  296. }
  297. });
  298. },
  299. //设置列表日期显示
  300. getReportListDate(e){
  301. const isSameYear=moment(e).isSame(new Date(), 'year');
  302. if(isSameYear){//今年
  303. return moment(e).format('MM.DD')+' '+ moment(e).format('ddd')
  304. }else{
  305. return moment(e).format('YY.MM.DD')+' '+moment(e).format('ddd')
  306. }
  307. }
  308. }
  309. }
  310. </script>
  311. <style lang="scss">
  312. .van-sticky-wrap--fixed{
  313. background-color: #fff;
  314. }
  315. .nav-bar-wrap{
  316. .content{
  317. position: relative;
  318. height: 100%;
  319. .search-icon{
  320. position: absolute;
  321. left: 134rpx;
  322. top: 50%;
  323. transform: translateY(-50%);
  324. }
  325. .avatar {
  326. width: 60rpx;
  327. height: 60rpx;
  328. border-radius: 50%;
  329. position: absolute;
  330. left: 34rpx;
  331. top: 50%;
  332. transform: translateY(-50%);
  333. }
  334. }
  335. }
  336. </style>
  337. <style lang="scss" scoped>
  338. movable-area{
  339. position: fixed;
  340. top: 50%;
  341. left: 0;
  342. width: 100%;
  343. height: calc(50% - 100rpx);
  344. pointer-events: none;
  345. z-index: 3;
  346. movable-view{
  347. width:fit-content;
  348. height:fit-content;
  349. pointer-events: auto;
  350. }
  351. }
  352. .top-sticky{
  353. position: sticky;
  354. top: 0;
  355. left: 0;
  356. z-index: 99;
  357. }
  358. .nav-bar-wrap{
  359. border-bottom: 1px solid $global-border-color;
  360. .content{
  361. .text{
  362. text-align: center;
  363. width: 50vw;
  364. position: absolute;
  365. left: 50%;
  366. top: 50%;
  367. transform: translate(-50%,-50%);
  368. font-weight: bold;
  369. font-size: 16px;
  370. }
  371. }
  372. }
  373. .type-wrap{
  374. // border-bottom: 1px solid $global-border-color;
  375. padding: 20rpx 34rpx 0 34rpx;
  376. box-shadow: 0px 4rpx 4rpx 1px rgba(198, 198, 198, 0.25);
  377. .avatar{
  378. width:78rpx;
  379. height:78rpx;
  380. border-radius: 50%;
  381. overflow: hidden;
  382. margin-right: 30rpx;
  383. }
  384. .first-type-box{
  385. justify-content: space-between;
  386. .item{
  387. min-width: 120rpx;
  388. flex-shrink: 0;
  389. text-align: center;
  390. padding: 16rpx 0;
  391. text-align: center;
  392. background-color: #F5F5F5;
  393. border-radius: 8rpx;
  394. font-size: $global-font-size-sm;
  395. image{
  396. width: 100rpx;
  397. height: 100rpx;
  398. display: block;
  399. margin: 0 auto 15rpx auto;
  400. }
  401. }
  402. .act {
  403. background: #FDF8F2;
  404. color: #E3B377;
  405. }
  406. }
  407. .sub-type-box{
  408. margin-top: 40rpx;
  409. font-size: 28rpx;
  410. color: #666666;
  411. overflow-x: auto;
  412. &::-webkit-scrollbar{
  413. width: 0;
  414. height: 0;
  415. display: none;
  416. }
  417. .item{
  418. padding-bottom: 16rpx;
  419. margin-right: 50rpx;
  420. flex-shrink: 0;
  421. }
  422. .active{
  423. color: #E3B377;
  424. border-bottom: 2px solid #E3B377;
  425. }
  426. }
  427. }
  428. .list-wrap{
  429. padding: 20rpx 34rpx;
  430. .list-item{
  431. margin-bottom: 40rpx;
  432. .time{
  433. margin-bottom: 32rpx;
  434. }
  435. }
  436. .content-list{
  437. .content-box{
  438. padding: 0 0rpx 20rpx 20rpx;
  439. position: relative;
  440. .all-btn{
  441. position: absolute;
  442. right: 20rpx;
  443. bottom: 20rpx;
  444. width: 95rpx;
  445. height: 34rpx;
  446. background: linear-gradient(100deg, #E3B377 0%, #FFDDB1 100%);
  447. border-radius: 17rpx;
  448. color: #fff;
  449. font-size: 24rpx;
  450. text-align: center;
  451. }
  452. }
  453. .content-item{
  454. padding:0 0 50rpx 20rpx;
  455. border-left: 1px solid #F4E1C9;
  456. position: relative;
  457. &:last-child{
  458. border-bottom: none;
  459. padding-bottom: 0rpx;
  460. }
  461. &::before{
  462. content: '';
  463. display: block;
  464. box-sizing: border-box;
  465. width: 24rpx;
  466. height: 24rpx;
  467. border-radius: 50%;
  468. border: 6rpx solid #F4E1C9;
  469. position: absolute;
  470. left: 0;
  471. top: 0;
  472. background: #E3B377;
  473. transform: translate(-50%,-50%);
  474. z-index: 2;
  475. }
  476. &::after{
  477. content:'';
  478. display: block;
  479. width: 34rpx;
  480. height: 1rpx;
  481. background-color: #F4E1C9;
  482. position: absolute;
  483. top: 0;
  484. left: 0;
  485. z-index: 1;
  486. }
  487. .c-time{
  488. position: relative;
  489. top: -17rpx;
  490. font-size: 24rpx;
  491. color: #333333;
  492. }
  493. .c-title{
  494. font-size: $global-font-size-lg;
  495. font-weight: bold;
  496. word-wrap: break-word;
  497. white-space: normal;
  498. word-break: break-all;
  499. }
  500. .desc{
  501. line-height: 1.5;
  502. margin-top: 10rpx;
  503. color: #666666;
  504. }
  505. .tags{
  506. margin-top: 20rpx;
  507. color: #E3B377;
  508. min-height: 40rpx;
  509. }
  510. }
  511. }
  512. }
  513. .quesion-btn{
  514. width:100rpx;
  515. height:100rpx;
  516. background-color: red;
  517. border-radius: 50%;
  518. z-index: 50;
  519. }
  520. .tab-card {
  521. display: flex;
  522. padding: 40rpx 34rpx 20rpx;
  523. align-items: center;
  524. justify-content: space-between;
  525. .card-item {
  526. // margin-right: 40rpx;
  527. // &:last-child { margin-right: 0; }
  528. .card-ico {
  529. width: 100rpx;
  530. height: 100rpx;
  531. display: block;
  532. }
  533. .title {
  534. text-align: center;
  535. }
  536. }
  537. }
  538. </style>