chartPage.vue 3.3 KB

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