freeTrial.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <template>
  2. <view class="container container-free">
  3. <view class="nav-bar-wrap" :style="{ height: navBarStyle.height, paddingTop: navBarStyle.paddingTop, paddingBottom: navBarStyle.paddingBottom }">
  4. <view class="content">
  5. <van-icon custom-class="search-icon" name="arrow-left" size="24px" @click="goSearch" />
  6. <view class="text">免费送月卡</view>
  7. </view>
  8. </view>
  9. <view class="img-code">
  10. <image :src="wechatCode"></image>
  11. </view>
  12. <view class="btn-box">
  13. <button class="bottom_in" open-type="share" plain="true">分享</button>
  14. <view @click="goSearch" class="btn-back">返回</view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. import { FreeButton } from "@/config/api.js";
  20. export default {
  21. data() {
  22. return {
  23. wechatCode:'',//二维码
  24. scene:"",//用户的id
  25. };
  26. },
  27. methods: {
  28. initNavBar() {
  29. let menuButtonInfo = uni.getMenuButtonBoundingClientRect();
  30. this.navBarStyle = {
  31. height: menuButtonInfo.height + menuButtonInfo.top + 8 + "px",
  32. paddingTop: menuButtonInfo.top - 4 + "px",
  33. paddingBottom: "4px",
  34. };
  35. },
  36. goSearch() {
  37. uni.navigateBack();
  38. },
  39. async wechatShareImage() {
  40. const res = await FreeButton.wechatShareImage();
  41. if(res.Ret === 200) {
  42. this.wechatCode = res.Data.FileLink
  43. this.scene = res.Data.Scene
  44. }
  45. },
  46. },
  47. onLoad() {
  48. this.initNavBar();
  49. this.wechatShareImage()
  50. },
  51. /**
  52. * 用户点击分享
  53. */
  54. onShareAppMessage: function (res) {
  55. return {
  56. title: "送您一张免费月卡",
  57. path: "/pageMy/excessivePages/excessivePages?scene="+this.scene,
  58. imageUrl: "https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/share_month.png",
  59. };
  60. },
  61. };
  62. </script>
  63. <style lang="scss">
  64. .nav-bar-wrap {
  65. color: #fff;
  66. position: fixed;
  67. top: 0;
  68. left: 0;
  69. width: 100%;
  70. z-index: 999;
  71. .content {
  72. position: relative;
  73. height: 100%;
  74. .search-icon {
  75. position: absolute;
  76. left: 34rpx;
  77. top: 50%;
  78. transform: translateY(-50%);
  79. }
  80. }
  81. }
  82. </style>
  83. <style lang="scss" scoped>
  84. .container-free {
  85. position: relative;
  86. width: 100%;
  87. height: 100%;
  88. background: url("https://hzchart.oss-cn-shanghai.aliyuncs.com/cygx/czbk/background_image.jpg") no-repeat;
  89. background-size: 100% 100%;
  90. .btn-box {
  91. position: absolute;
  92. bottom: 115rpx;
  93. left: 50%;
  94. transform: translateX(-50%);
  95. text-align: center;
  96. font-size: 34rpx;
  97. color: #fff;
  98. padding-bottom: constant(safe-area-inset-bottom);
  99. padding-bottom: env(safe-area-inset-bottom);
  100. }
  101. .bottom_in {
  102. width: 379rpx;
  103. height: 80rpx;
  104. line-height: 80rpx;
  105. background: linear-gradient(180deg, #f8d083 0%, #f0b157 100%);
  106. border: none;
  107. font-weight: 600;
  108. margin-bottom: 20rpx;
  109. color: #fff;
  110. }
  111. .btn-back {
  112. width: 379rpx;
  113. height: 80rpx;
  114. border: 1px solid #f1e2ce;
  115. line-height: 78rpx;
  116. }
  117. .img-code {
  118. width: 200rpx;
  119. height: 200rpx;
  120. position: absolute;
  121. top: 46%;
  122. left: 50%;
  123. transform: translate(-50%, -50%);
  124. image {
  125. width: 100%;
  126. height: 100%;
  127. }
  128. }
  129. }
  130. .nav-bar-wrap {
  131. .content {
  132. .text {
  133. text-align: center;
  134. width: 50vw;
  135. position: absolute;
  136. left: 50%;
  137. top: 50%;
  138. transform: translate(-50%, -50%);
  139. font-weight: bold;
  140. font-size: 16px;
  141. }
  142. }
  143. }
  144. </style>