chartPage.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="container reportDetail-container">
  3. <web-view :src="strategyUrl + '?url=' + httpUrl" v-if="httpUrl">
  4. <cover-view class="footer-con">
  5. <cover-view class="handle-item" @click="collectHandle">
  6. <cover-image
  7. class="download-img"
  8. :src="isCollection ? 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_act.png' : 'https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/collect_ico.png'"
  9. ></cover-image>
  10. <cover-view>收藏</cover-view>
  11. </cover-view>
  12. </cover-view>
  13. </web-view>
  14. </view>
  15. </template>
  16. <script>
  17. import { Chart } from "@/config/api.js";
  18. import freeCharge from "@/components/freeCharge";
  19. import { reportStrategyUrl } from "@/config/config";
  20. let app = getApp({ allowDefault: true });
  21. export default {
  22. data() {
  23. return {
  24. id: "",
  25. httpUrl: "",
  26. isCollection: false,
  27. chartData: {},
  28. };
  29. },
  30. components: {
  31. freeCharge,
  32. },
  33. computed: {
  34. strategyUrl() {
  35. // web-view 的URL
  36. return reportStrategyUrl;
  37. },
  38. },
  39. methods: {
  40. /* 获取详情 */
  41. async myChartDetail() {
  42. const res = await Chart.myChartDetail({
  43. ChartId: Number(this.id),
  44. PageRouter: this.$store.state.pageRouterReport,
  45. });
  46. if (res.Ret === 200) {
  47. this.chartData = res.Data;
  48. this.isCollection = res.Data.IsCollection;
  49. this.httpUrl = encodeURIComponent(res.Data.HttpUrl);
  50. uni.setNavigationBarTitle({
  51. title: this.chartData.Title,
  52. });
  53. }
  54. },
  55. /* 收藏 */
  56. async collectHandle() {
  57. const res = await Chart.myChartCollect({
  58. ChartId: this.chartData.ChartId,
  59. });
  60. if (res.Ret === 200) {
  61. this.isCollection = res.Data.Status == 1 ? true : false;
  62. this.$util.toast(res.Msg);
  63. }
  64. },
  65. },
  66. onLoad(option) {
  67. this.id = option.id || "";
  68. },
  69. async onShow() {
  70. await this.$store.dispatch("checkHandle");
  71. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  72. //已授权已绑定 才获取详情
  73. this.id && this.myChartDetail();
  74. }
  75. },
  76. /**
  77. * 用户点击分享
  78. */
  79. onShareAppMessage: function (res) {
  80. return {
  81. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.chartData.Title,
  82. path: "/pageMy/chartPage/chartPage?id=" + this.id,
  83. };
  84. },
  85. };
  86. </script>
  87. <style lang="scss" scoped>
  88. .reportDetail-container {
  89. background-color: #fff;
  90. .footer-con {
  91. position: fixed;
  92. z-index: 99999;
  93. bottom: 0;
  94. padding-bottom: constant(safe-area-inset-bottom);
  95. padding-bottom: env(safe-area-inset-bottom);
  96. left: 0;
  97. width: 100%;
  98. background-color: #ffffff;
  99. display: flex;
  100. justify-content: space-around;
  101. height: 100rpx;
  102. border-top: 1px solid #dddddd;
  103. .handle-item {
  104. align-items: center;
  105. display: flex;
  106. flex-direction: column;
  107. justify-content: center;
  108. position: relative;
  109. z-index: 99999;
  110. .download-img {
  111. width: 44rpx;
  112. height: 44rpx;
  113. margin-bottom: 4rpx;
  114. }
  115. }
  116. }
  117. }
  118. </style>