Qrcode.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="qrcode-modal" :class="{show: show}">
  3. <view class="content">
  4. <view class="qrcode-modal-content dir-top-wrap cross-center">
  5. <view class="head-img">
  6. <u-image
  7. width="150rpx"
  8. height="150rpx"
  9. :src="userInfo.avatar"
  10. shape="circle"
  11. />
  12. </view>
  13. <view class="nickname">{{ userInfo.nickname }}</view>
  14. <u-line class="u-line" border-style="dashed" length="90%" />
  15. <view class="qrcode">
  16. <u-image
  17. width="320rpx"
  18. height="320rpx"
  19. :src="userInfo.share_qrcode"
  20. />
  21. </view>
  22. </view>
  23. <u-button
  24. shape="circle"
  25. hover-class="none"
  26. :custom-style="{
  27. background:'linear-gradient(270deg, #6EEBE8 0%, #FF74B9 100%)',
  28. boxShadow: '0 0 20rpx rgba(13,239,250,.3)',
  29. borderColor:'none',
  30. color: '#ffffff',
  31. marginTop: '50rpx'}"
  32. @click="handleSave"
  33. >保存</u-button>
  34. <u-button
  35. shape="circle"
  36. hover-class="none"
  37. :custom-style="{
  38. borderColor:'none',
  39. marginTop: '30rpx'}"
  40. @click="handleCancel"
  41. >取消</u-button>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. import { mapState } from 'vuex'
  47. export default {
  48. name: 'Qrcode',
  49. props: {
  50. show: {
  51. type: Boolean,
  52. default: false
  53. }
  54. },
  55. data() {
  56. return {}
  57. },
  58. computed: {
  59. ...mapState({
  60. userInfo: seate => seate.user.info
  61. })
  62. },
  63. methods: {
  64. handleSave() {
  65. console.log('-->data', this.userInfo.share_qrcode)
  66. this.$util.saveImage(this.userInfo.share_qrcode).then(res => {
  67. this.$emit('update:show', false)
  68. })
  69. },
  70. handleCancel() {
  71. this.$emit('update:show', false)
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .qrcode-modal{
  78. position: fixed;
  79. top: 0;
  80. left: 0;
  81. width: 750rpx;
  82. height: 100vh;
  83. background: $bg-color;
  84. z-index: 999;
  85. display: none;
  86. animation: show-modal linear .5s;
  87. &.show{
  88. display: block;
  89. }
  90. .content{
  91. position: absolute;
  92. width: 600rpx;
  93. top: 50%;
  94. left: 50%;
  95. transform: translate(-50%,-50%);
  96. .qrcode-modal-content{
  97. background: #1B203C;
  98. position: relative;
  99. width: 100%;
  100. height: 50vh;
  101. background: url("/static/image/share-qrcode-bg.png") no-repeat center;
  102. background-size: 100% 100%;
  103. .head-img{
  104. position: absolute;
  105. top: -75rpx;
  106. }
  107. .nickname{
  108. position: absolute;
  109. color: #ffffff;
  110. top: 15%;
  111. font-size: 34rpx;
  112. }
  113. .u-line{
  114. position: absolute;
  115. top: 28.55%;
  116. }
  117. .qrcode{
  118. position: absolute;
  119. top: 35%;
  120. }
  121. }
  122. }
  123. }
  124. @keyframes show-modal {
  125. 0%{opacity: 0;}
  126. 100%{opacity: 1;}
  127. }
  128. </style>