report.vue 13 KB

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