shareQrCode.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 = this.baseURL+ this.urlFile+'/#/pages/index/index?spread=' + this.userInfo.uid
  63. }
  64. },
  65. computed: {
  66. ...mapState(['baseURL', 'urlFile']),
  67. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  68. },
  69. methods: {
  70. qrR(res) {
  71. this.src = res;
  72. },
  73. }
  74. };
  75. </script>
  76. <style lang="scss">
  77. .baseimg {
  78. width: 100%;
  79. }
  80. .erweima {
  81. width: 300rpx;
  82. position: absolute;
  83. top: 928rpx;
  84. left: 0;
  85. right: 0;
  86. margin: auto;
  87. display: flex;
  88. justify-content: center;
  89. }
  90. </style>