invite.vue 4.5 KB

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