index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <view class="page" :style="{ 'height': setHeight + 'px' }">
  3. <image src="../../../static/images/spread.png" mode="widthFix" class="image"></image>
  4. <button class="share" @click='copy'>分享H5 邀请好友</button>
  5. <view class="qrcode">
  6. <image :src="qrcode"></image>
  7. </view>
  8. <view class="tip">佣金计算方式=好友支付订单包裹数 * 0.05元/单</view>
  9. </view>
  10. </template>
  11. <script>
  12. import {
  13. mapGetters
  14. } from "vuex";
  15. import {
  16. toLogin
  17. } from '@/libs/login.js';
  18. import {
  19. spreadLink
  20. } from '@/api/api.js';
  21. import Qr from "@/utils/wxqrcode.js";
  22. import H5Api from '@/utils/ican-H5Api.js'
  23. export default {
  24. data() {
  25. return {
  26. link:'',
  27. qrcode: '',
  28. setHeight: 0
  29. }
  30. },
  31. computed: mapGetters(['isLogin']),
  32. mounted() {
  33. let that = this
  34. uni.getSystemInfo({
  35. success: function (res) {
  36. that.setHeight = res.windowHeight
  37. }
  38. })
  39. },
  40. onLoad() {
  41. if (this.isLogin) {
  42. this.getSpreadLink();
  43. }else{
  44. toLogin();
  45. }
  46. },
  47. methods: {
  48. getSpreadLink: function() {
  49. let that = this;
  50. spreadLink().then(res => {
  51. that.link = window.location.protocol+"//"+window.location.host + res.data.url3;
  52. that.qrcode = Qr.createQrCodeImg(that.link, {typeNumber: 7});
  53. });
  54. },
  55. copy: function() {
  56. uni.setClipboardData({
  57. data: '我发现一个电商人必备的礼品代发网站,注册网址是 ' + this.link,
  58. success:function(){
  59. uni.showToast({
  60. title: '复制成功'
  61. })
  62. }
  63. })
  64. }
  65. }
  66. }
  67. </script>
  68. <style scoped lang="scss">
  69. .page{background: #fff6d7;}
  70. .image{
  71. width:100%;
  72. vertical-align: bottom;
  73. }
  74. .share{
  75. width:90%;
  76. margin: 0 auto;
  77. margin-top: 60rpx;
  78. line-height: 88rpx;
  79. border-radius: 60rpx;
  80. font-size: 32rpx;
  81. color:#fff;
  82. background: linear-gradient(rgb(255, 142, 109) 0%, rgb(255, 53, 22) 100%);
  83. }
  84. .qrcode{
  85. width:220rpx;
  86. height:220rpx;
  87. background: #fff;
  88. margin: 0 auto;
  89. margin-top: 50rpx;
  90. image{
  91. width:200rpx;
  92. height:200rpx;
  93. margin-top: 10rpx;
  94. margin-left: 10rpx;
  95. }
  96. }
  97. .tip {
  98. color: #983f3f;
  99. line-height: 40rpx;
  100. margin-top: 30rpx;
  101. text-align: center;
  102. }
  103. </style>