invite.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <view class="container">
  3. <image class="bk" :src="$fileUrl() + '/invite/bk.png'" mode=""></image>
  4. <view class="page">
  5. <image class="illustrate" @click="$navigateTo('/pages/rule/rule', {type: 6})" :src="$fileUrl() + '/invite/button1.png'" mode=""></image>
  6. <view class="box">
  7. <view class="item">
  8. <image mode="aspectFit" class="label1" :src="$fileUrl() + '/invite/text2.png'"></image>
  9. <view class="value">
  10. {{person}}
  11. <image mode="aspectFit" :src="$fileUrl() + '/invite/text3.png'"></image>
  12. </view>
  13. </view>
  14. <view class="item">
  15. <image mode="aspectFit" class="label2" :src="$fileUrl() + '/invite/text1.png'"></image>
  16. <view class="value">
  17. {{reward}}
  18. <image mode="aspectFit" :src="$fileUrl() + '/invite/text4.png'"></image>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="buttons">
  23. <button open-type="share" class="button">
  24. <image class="button1" mode="aspectFit" :src="$fileUrl() + '/invite/button2.png'"></image>
  25. </button>
  26. <image class="button2" mode="aspectFit" :src="$fileUrl() + '/invite/button3.png'" @click="promotionCode">
  27. </image>
  28. <!-- <view class="m_button">
  29. 邀请好友
  30. </view> -->
  31. <!-- <view class="m_button" @click="promotionCode">
  32. 我的推广码
  33. </view> -->
  34. </view>
  35. </view>
  36. <uni-popup ref="popup" background-color="#fff">
  37. <view class="popup-content">
  38. <image class="qrcode" :src="imgUrl" mode=""></image>
  39. </view>
  40. </uni-popup>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. inviteQrcodeApi,
  46. inviteInfoApi
  47. } from "@/api/invite.js"
  48. export default {
  49. data() {
  50. return {
  51. imgUrl: '',
  52. inviteList: [],
  53. person: '',
  54. reward: '',
  55. }
  56. },
  57. onLoad() {
  58. this.getInviteList()
  59. },
  60. onShow() {
  61. this.getInviteList()
  62. },
  63. computed: {
  64. userInfo() {
  65. return wx.getStorageSync('userInfo')
  66. }
  67. },
  68. onShareAppMessage() {
  69. let userId = wx.getStorageSync('userId')
  70. return {
  71. title: this.userInfo.nickName + '邀请你来宝可梦卡牌抽取喜欢的卡牌',
  72. path: '/pages/index/index?inviteId=' + userId
  73. }
  74. },
  75. methods: {
  76. getInviteList() {
  77. inviteInfoApi().then(res => {
  78. console.log(res, '我已经邀请的列表')
  79. this.inviteList = res.data.list
  80. this.person = res.data.person
  81. this.reward = res.data.reward
  82. })
  83. },
  84. promotionCode() {
  85. let _this = this
  86. inviteQrcodeApi().then(res => {
  87. console.log(res, '推广码')
  88. _this.imgUrl = res.data
  89. _this.$refs.popup.open('center')
  90. })
  91. }
  92. }
  93. }
  94. </script>
  95. <style scoped lang="scss">
  96. .container {
  97. // background: #e7ffec;
  98. text-align: center;
  99. .bk {
  100. position: absolute;
  101. height: 100vh;
  102. width: 100%;
  103. z-index: -1;
  104. }
  105. .page {
  106. max-height: 100vh;
  107. overflow: auto;
  108. padding-top: 300px;
  109. }
  110. .illustrate {
  111. position: absolute;
  112. right: 20px;
  113. top: 40px;
  114. font-size: 12px;
  115. width: 67px;
  116. height: 24px;
  117. // padding: 5px 10px;
  118. // border-radius: 4px;
  119. }
  120. .box {
  121. background: #fff;
  122. margin: 20px 20px;
  123. padding: 20px;
  124. border-radius: 15px;
  125. display: flex;
  126. justify-content: space-around;
  127. .item {
  128. display: flex;
  129. flex-direction: column;
  130. justify-content: center;
  131. align-items: center;
  132. width: 50%;
  133. .label1 {
  134. width: 100%;
  135. height: 22px;
  136. }
  137. .label2 {
  138. width: 100%;
  139. height: 22px;
  140. }
  141. .value {
  142. font-size: 28px;
  143. font-weight: 600;
  144. margin-top: 20px;
  145. width: 100%;
  146. display: flex;
  147. align-items: center;
  148. justify-content: center;
  149. image {
  150. width: 40px;
  151. height: 22px;
  152. }
  153. }
  154. }
  155. }
  156. .buttons {
  157. display: flex;
  158. justify-content: center;
  159. margin: 20px;
  160. width: calc(100% - 40px);
  161. image {
  162. height: 64px;
  163. position: relative;
  164. }
  165. .button {
  166. background: none;
  167. border: none !important;
  168. overflow: initial;
  169. text-align: start;
  170. padding: 0;
  171. width: 100%;
  172. box-shadow: none;
  173. -webkit-tap-highlight-color: transparent;
  174. }
  175. .button::after {
  176. border: none;
  177. }
  178. .button1 {
  179. right: -8px;
  180. width: 100%;
  181. }
  182. .button2 {
  183. left: -8px;
  184. }
  185. }
  186. .qrcode {
  187. width: 70vw;
  188. height: 70vw;
  189. }
  190. }
  191. </style>