erweima.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <template>
  2. <view class="add main-bg">
  3. <view class="header">
  4. <view class="title font-color3 font-thirty-two">军人唯一识别码</view>
  5. <view class="img">
  6. <image class="image" :src="data"></image>
  7. </view>
  8. <view class="text">
  9. <view class="time font-thirty-two font-color4">本码有效期: 5分钟</view>
  10. <view class="obtain font-thirty-two font-color2" @click="getImg(userInfo.userId, userInfo.type)">重新获取</view>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import server from "@/api/index";
  17. export default {
  18. data() {
  19. return {
  20. userInfo: {},
  21. data: ''
  22. }
  23. },
  24. onLoad() {
  25. this.userInfo = uni.getStorageSync('userInfo');
  26. this.getImg(this.userInfo.userId, this.userInfo.type);
  27. },
  28. methods:{
  29. getImg(id, type){
  30. console.log('id', id)
  31. server.getUserQrCode(id,type).then(res=>{
  32. console.log(res)
  33. this.data = res
  34. })
  35. }
  36. }
  37. }
  38. </script>
  39. <style lang="scss" scoped>
  40. .add{
  41. width: 100%;
  42. height: auto;
  43. min-height: 100vh;
  44. padding: 30rpx 30rpx 30rpx;
  45. }
  46. .header{
  47. margin-top: 30rpx;
  48. height: 655rpx;
  49. width: 100%;
  50. background: #FFF;
  51. border-radius: 24rpx;
  52. // position: relative;
  53. .title{
  54. height: 165rpx;
  55. line-height: 165rpx;
  56. letter-spacing: 2rpx;
  57. width: 100%;
  58. text-align: center;
  59. font-weight: 600;
  60. }
  61. .img{
  62. width: 400rpx;
  63. height: 400rpx;
  64. margin: 0 auto;
  65. position: relative;
  66. .image{
  67. width: 400rpx;
  68. height: 400rpx;
  69. border-radius: 24rpx;
  70. position: absolute;
  71. top: 0rpx;
  72. left: 0rpx;
  73. }
  74. }
  75. .text{
  76. display: flex;
  77. justify-content: space-between;
  78. margin-top: 30rpx;
  79. height: 30rpx;
  80. line-height: 30rpx;
  81. .time{
  82. padding-left: 30rpx;
  83. }
  84. .obtain{
  85. padding-right: 30rpx;
  86. letter-spacing: 2rpx;
  87. font-weight: 600;
  88. text-align: right;
  89. }
  90. }
  91. }
  92. </style>