shareQrCode.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="content">
  3. <image src="../../static/img/sharebase.png" mode="widthFix" class="baseimg"></image>
  4. <view class="erweima">
  5. <tki-qrcode
  6. :cid="cid"
  7. ref="qrcode"
  8. :val="val"
  9. :size="size"
  10. :unit="unit"
  11. :background="background"
  12. :foreground="foreground"
  13. :pdground="pdground"
  14. :iconSize="iconSize"
  15. :lv="lv"
  16. :onval="onval"
  17. :loadMake="loadMake"
  18. :usingComponents="usingComponents"
  19. @result="qrR"
  20. />
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. mapState,
  27. mapMutations
  28. } from 'vuex';
  29. import {
  30. getUserInfo
  31. } from '@/api/user.js';
  32. export default {
  33. data() {
  34. return {
  35. val: '',
  36. cid: 'cid',
  37. size: 150,
  38. unit: '150',
  39. background: '#FFFFFF',
  40. foreground: '#000000',
  41. pdground: '#000000',
  42. icon: '',
  43. iconSize: 40,
  44. lv: 3,
  45. onval: true,
  46. loadMake: true,
  47. usingComponents: true,
  48. };
  49. },
  50. onLoad() {
  51. const obj = this;
  52. if(!this.userInfo.uid){
  53. getUserInfo({}).then(e => {
  54. // 保存返回用户数据
  55. obj.setUserInfo(e.data);
  56. //成功跳转首页
  57. uni.switchTab({
  58. url: '/pages/index/index'
  59. });
  60. });
  61. }else{
  62. this.val = 'http://hgd.liuniu946.com/appdom/index.html?spread=' + this.userInfo.uid
  63. }
  64. },
  65. onShow() {
  66. },
  67. //下拉刷新
  68. onPullDownRefresh() {
  69. },
  70. computed: {
  71. ...mapState(['baseURL', 'urlFile']),
  72. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  73. },
  74. methods: {
  75. qrR(res) {
  76. this.src = res;
  77. },
  78. }
  79. };
  80. </script>
  81. <style lang="scss">
  82. .baseimg {
  83. width: 100%;
  84. }
  85. .erweima {
  86. width: 300rpx;
  87. position: absolute;
  88. top: 948rpx;
  89. left: 0;
  90. right: 0;
  91. margin: auto;
  92. display: flex;
  93. justify-content: center;
  94. }
  95. </style>