invite.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view class="invite">
  3. <view class="title">
  4. 邀请好友加入慧研学惠生活
  5. </view>
  6. <view class="desc">
  7. 您将获得现金红包奖励
  8. </view>
  9. <view class="code-box">
  10. <image class="head" :src="userInfo.imgPath" mode=""></image>
  11. <view class="user-name">
  12. {{userInfo.nickname}}
  13. </view>
  14. <view class="qrcode-box">
  15. <u--image width="380rpx" height="380rpx" :src="src">
  16. <template v-slot:loading>
  17. <u-loading-icon size="56rpx" color="#FF4C3A"></u-loading-icon>
  18. </template>
  19. </u--image>
  20. </view>
  21. </view>
  22. <view class="save-btn">
  23. <u-button color="linear-gradient(265deg, #FF4A39 0%, #FC8B45 100%)" shape="circle" type="primary" @click="save">保存二维码</u-button>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {BASE_URL} from '@/utils/config.js'
  29. export default {
  30. data() {
  31. return {
  32. src: '',
  33. userInfo:{}
  34. }
  35. },
  36. methods: {
  37. save() {
  38. uni.getImageInfo({
  39. src:this.src,
  40. success: function (image) {
  41. uni.saveImageToPhotosAlbum({
  42. filePath:image.path
  43. })
  44. }
  45. })
  46. },
  47. },
  48. created() {
  49. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'))
  50. uni.request( {
  51. url:BASE_URL+'/zswl-cloud-bdb/promotion/qrcode',
  52. method:"post",
  53. data: {
  54. "scene": JSON.parse(uni.getStorageSync('userInfo')).userId ,
  55. },
  56. responseType:'arraybuffer'
  57. }).then(res=>{
  58. this.src = 'data:image/png;base64,' + uni.arrayBufferToBase64(res.data)
  59. })
  60. }
  61. }
  62. </script>
  63. <style lang="scss">
  64. .invite .u-image__loading,.u-image__error{
  65. background-color: #fff!important;
  66. }
  67. .invite{
  68. padding: 0 30rpx;
  69. min-height: 100vh;
  70. background: url('http://zswl-dev.oss-cn-chengdu.aliyuncs.com/63b7c68b71a69169d1b33f92/store/bdb/user/avatar/SpRgpIr81Trt13ba08b3b78f59f72c0a555b82b73492.png/1.png') no-repeat;
  71. background-size: 100% 100%;
  72. .title{
  73. text-align: center;
  74. font-size: 48rpx;
  75. font-weight: 800;
  76. margin-top: 178rpx;
  77. }
  78. .desc{
  79. margin-top: 20rpx;
  80. font-size: 28rpx;
  81. color: #999999;
  82. text-align: center;
  83. }
  84. .code-box{
  85. width: 690rpx;
  86. height: 650rpx;
  87. background: #fff;
  88. box-shadow: 0rpx 6rpx 20rpx 2rpx rgba(0,0,0,0.06);
  89. border-radius: 16rpx;
  90. position: relative;
  91. margin-top: 110rpx;
  92. .head{
  93. width: 162rpx;
  94. height: 162rpx;
  95. border-radius: 50%;
  96. position: absolute;
  97. top: 0;
  98. left: 50%;
  99. transform: translate(-50%,-50%);
  100. }
  101. .user-name{
  102. padding-top: 100rpx;
  103. text-align: center;
  104. font-size: 32rpx;
  105. color: #222222;
  106. font-weight: bold;
  107. }
  108. .qrcode-box{
  109. width: 380rpx;
  110. height: 380rpx;
  111. margin: 80rpx auto;
  112. display: flex;
  113. justify-content: center;
  114. align-items: center;
  115. }
  116. }
  117. .save-btn {
  118. position: fixed;
  119. bottom: 100rpx;
  120. width: calc(100% - 60rpx) ;
  121. }
  122. }
  123. </style>