qr.vue 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view class="container">
  3. <view class='qr-wrap' v-if='qrstatus==true&&show==1'>
  4. <view>
  5. <image :src='qrcode'></image>
  6. </view>
  7. <text>扫一扫上面的二维码</text>
  8. </view>
  9. <view class='no-qrcode' v-if='show==0'>当前暂无可用二维码</view>
  10. </view>
  11. </template>
  12. <script>
  13. import uploadImage from '@/components/ossutil/uploadFile.js';
  14. import uniNumberBox from '@/components/uni-number-box.vue';
  15. import {
  16. mapState
  17. } from 'vuex';
  18. export default {
  19. components: {
  20. uniNumberBox
  21. },
  22. data() {
  23. return {
  24. qrstatus:false,
  25. qrcode:"",
  26. show:1,
  27. }
  28. },
  29. onShow() {
  30. },
  31. onLoad(options) {
  32. const that = this
  33. that.$api.request('user', 'getQrCode', {
  34. }, failres => {
  35. that.$api.msg(failres.errmsg)
  36. uni.hideLoading()
  37. }).then(res => {
  38. if(res.data=='error'){
  39. that.show=0
  40. }else{
  41. that.qrstatus=true
  42. that.qrcode = res.data
  43. }
  44. })
  45. },
  46. computed: {
  47. ...mapState(['hasLogin','userInfo'])
  48. },
  49. methods: {
  50. }
  51. }
  52. </script>
  53. <style lang='scss' scoped>
  54. .container {
  55. background: $page-color-base;
  56. padding-bottom: 160upx;
  57. }
  58. .qr-wrap{
  59. text-align:center;
  60. height:100vh;
  61. }
  62. .no-qrcode{
  63. text-align: center;
  64. line-height: 100vh;
  65. height: 100vh;
  66. }
  67. </style>