report.vue 14 KB

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