report.vue 11 KB

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