scan.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view>
  3. <!-- 背景图 -->
  4. <view class="top">
  5. <image src="./icon/bg.png" mode="aspectFill"></image>
  6. </view>
  7. <view class="section_1">
  8. <view class="user">
  9. <view class="name">{{user.name}}</view>
  10. <view class="inner">
  11. <view class="text">工号:{{user.staff_num}}</view>
  12. <view class="text">部门:{{user.section}}</view>
  13. </view>
  14. </view>
  15. <view class="scan">
  16. <view style="width: 286rpx;padding-left: 24rpx;">
  17. <yz-qr :qrPath.sync="qrPath" :text="text" :size="size" :quality="quality" :colorDark="colorDark"
  18. :colorLight="colorLight"></yz-qr>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="section_2">
  23. <view class="title">扫码记录</view>
  24. <view class="list" v-if="list.length > 0">
  25. <view class="line">
  26. <view class="time">时间</view>
  27. <view class="text">结果</view>
  28. </view>
  29. <view class="line" v-for="(item,index) in list" :key="index" v-if="index<8">
  30. <view class="time">{{item.created_at}}</view>
  31. <view class="text" v-if="item.type == 1">入矿</view>
  32. <view class="text" v-if="item.type == 2">堂食</view>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. user: {},
  43. scan_img: "",
  44. list: [],
  45. // 生成二维码
  46. qrPath: '',
  47. text: '',
  48. size: 143,
  49. quality: 'L',
  50. colorDark: '#000000',
  51. colorLight: '#ffffff'
  52. };
  53. },
  54. onLoad() {
  55. this.user = uni.getStorageSync('user')
  56. console.log(this.user)
  57. this.text = 'http://anstatic.nxmy.com:8011/assets/html/zhks-quankuang/yangchangwan/h5/#/pages/my/scan/scan_result/scan_result?staff_num=' +
  58. this.user.staff_num + '&section_fullname=' + this.user.section + '&name=' + this.user.name
  59. this.get_scan()
  60. console.log(this.scan_img)
  61. },
  62. methods: {
  63. get_scan() {
  64. this.$api.qr_code_userQrcodeInfo({
  65. }).then((res) => {
  66. console.log(res.data.data)
  67. this.scan_img = res.data.data.url
  68. this.list = res.data.data.record
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss">
  75. .top {
  76. z-index: -1;
  77. position: fixed;
  78. top: 1;
  79. left: 0;
  80. image {
  81. width: 750rpx;
  82. height: 746rpx;
  83. }
  84. }
  85. .section_1 {
  86. margin: 0 auto;
  87. width: 700rpx;
  88. height: 640rpx;
  89. background-image: url('./icon/section_1.png');
  90. background-size: cover;
  91. .user {
  92. padding-top: 90rpx;
  93. padding-bottom: 30rpx;
  94. .name {
  95. font-size: 42rpx;
  96. font-weight: 700;
  97. text-align: center;
  98. margin-bottom: 20rpx;
  99. }
  100. .inner {
  101. display: flex;
  102. justify-content: space-between;
  103. line-height: 40rpx;
  104. box-sizing: border-box;
  105. padding: 0 100rpx;
  106. .text {
  107. font-size: 28rpx;
  108. color: #666;
  109. }
  110. }
  111. }
  112. .scan {
  113. margin: 0 auto;
  114. width: 346rpx;
  115. height: 346rpx;
  116. background-image: url('./icon/scan_border.png');
  117. background-size: cover;
  118. box-sizing: border-box;
  119. // padding: 25rpx 30rpx;
  120. // padding-left: 24rpx;
  121. // padding-top: 30rpx;
  122. display: flex;
  123. align-items: center;
  124. }
  125. }
  126. .section_2 {
  127. margin: -26rpx auto 0;
  128. box-sizing: border-box;
  129. padding: 50rpx 20rpx;
  130. width: 650rpx;
  131. height: 640rpx;
  132. background-image: url('./icon/section_2.png');
  133. // background-size: cover;
  134. background-size: 100% 100%;
  135. .title {
  136. text-align: center;
  137. font-size: 36rpx;
  138. font-weight: 700;
  139. }
  140. .list {
  141. .line:first-child {
  142. font-size: 30rpx;
  143. font-weight: 700;
  144. line-height: 80rpx;
  145. }
  146. .line {
  147. display: flex;
  148. justify-content: space-around;
  149. text-align: center;
  150. font-size: 28rpx;
  151. color: #666;
  152. line-height: 50rpx;
  153. .time {
  154. width: 350rpx;
  155. }
  156. .text {
  157. width: 150rpx;
  158. }
  159. }
  160. }
  161. }
  162. </style>