report.vue 17 KB

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