freeTrial.vue 3.5 KB

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