invite.vue 4.9 KB

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