chartPage.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. });
  45. if (res.Ret === 200) {
  46. this.chartData = res.Data;
  47. this.isCollection = res.Data.IsCollection;
  48. this.httpUrl = encodeURIComponent(res.Data.HttpUrl);
  49. uni.setNavigationBarTitle({
  50. title: this.chartData.Title,
  51. });
  52. }
  53. },
  54. /* 收藏 */
  55. async collectHandle() {
  56. const res = await Chart.myChartCollect({
  57. ChartId: this.chartData.ChartId,
  58. });
  59. if (res.Ret === 200) {
  60. this.isCollection = res.Data.Status == 1 ? true : false;
  61. this.$util.toast(res.Msg);
  62. }
  63. },
  64. },
  65. onLoad(option) {
  66. this.id = option.id || "";
  67. },
  68. async onShow() {
  69. await this.$store.dispatch("checkHandle");
  70. if (!this.$store.state.isAuth && !this.$store.state.isBind) {
  71. //已授权已绑定 才获取详情
  72. this.id && this.myChartDetail();
  73. }
  74. },
  75. /**
  76. * 用户点击分享
  77. */
  78. onShareAppMessage: function (res) {
  79. return {
  80. title: this.isHorzMobile ? "好友向您推荐此内容,上传名片享查研观向免费月卡!" : this.chartData.Title,
  81. path: "/pageMy/chartPage/chartPage?id=" + this.id,
  82. };
  83. },
  84. };
  85. </script>
  86. <style lang="scss" scoped>
  87. .reportDetail-container {
  88. background-color: #fff;
  89. .footer-con {
  90. position: fixed;
  91. z-index: 99999;
  92. bottom: 0;
  93. padding-bottom: constant(safe-area-inset-bottom);
  94. padding-bottom: env(safe-area-inset-bottom);
  95. left: 0;
  96. width: 100%;
  97. background-color: #ffffff;
  98. display: flex;
  99. justify-content: space-around;
  100. height: 100rpx;
  101. border-top: 1px solid #dddddd;
  102. .handle-item {
  103. align-items: center;
  104. display: flex;
  105. flex-direction: column;
  106. justify-content: center;
  107. position: relative;
  108. z-index: 99999;
  109. .download-img {
  110. width: 44rpx;
  111. height: 44rpx;
  112. margin-bottom: 4rpx;
  113. }
  114. }
  115. }
  116. }
  117. </style>