scan_result.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  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">{{name}}</view>
  10. <view class="inner">
  11. <view class="text">工号:{{staff_num}}</view>
  12. <view class="text">部门:{{section}}</view>
  13. </view>
  14. </view>
  15. <view class="result">
  16. <uni-icons type="checkbox" size="100" color="#52C41A"></uni-icons>
  17. <view class="text">
  18. 正常
  19. </view>
  20. </view>
  21. </view>
  22. <view class="section_2">
  23. <view class="btn_list">
  24. <view class="btn" @click="post_result(1)" :style="state?'':'background-color: #ccc;'">
  25. <view class="icon">
  26. <uni-icons type="download-filled" size="30" color="#fff"></uni-icons>
  27. </view>
  28. <view class="text">
  29. 入矿
  30. </view>
  31. </view>
  32. <view class="btn" @click="post_result(2)" :style="state?'':'background-color: #ccc;'">
  33. <view class="icon">
  34. <uni-icons type="home-filled" size="30" color="#fff"></uni-icons>
  35. </view>
  36. <view class="text">
  37. 堂食
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. staff_num: "",
  49. section: "",
  50. name: "",
  51. // 提交状态
  52. state: true
  53. };
  54. },
  55. onLoad() {
  56. function GetQueryString(name) {
  57. let reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
  58. if (window.location.hash.indexOf("?") < 0) {
  59. return null;
  60. }
  61. let r = window.location.hash.split("?")[1].match(reg);
  62. if (r != null) return decodeURIComponent(r[2]);
  63. return null;
  64. }
  65. // 调用方法
  66. // alert(GetQueryString("参数名1"));
  67. // alert(GetQueryString("参数名2"));
  68. this.staff_num = GetQueryString("staff_num")
  69. this.name = GetQueryString("name")
  70. this.section = GetQueryString("section_fullname")
  71. },
  72. methods: {
  73. post_result(type) {
  74. if (this.state) {
  75. console.log(type)
  76. this.$api.qr_code_scanningRecord({
  77. staff_num: this.staff_num,
  78. type: type
  79. }).then((res) => {
  80. uni.showToast({
  81. icon: "none",
  82. title: "记录成功"
  83. })
  84. this.state = false
  85. })
  86. } else {
  87. uni.showToast({
  88. icon: "none",
  89. title: "已经提交过了,请不要重复提交!"
  90. })
  91. }
  92. }
  93. }
  94. }
  95. </script>
  96. <style lang="scss">
  97. .top {
  98. z-index: -1;
  99. position: fixed;
  100. top: 0;
  101. left: 0;
  102. image {
  103. width: 750rpx;
  104. height: 746rpx;
  105. }
  106. }
  107. .section_1 {
  108. margin: 0 auto;
  109. margin-top: 50rpx;
  110. width: 700rpx;
  111. height: 640rpx;
  112. background-image: url('../icon/section_1.png');
  113. background-size: cover;
  114. .user {
  115. padding-top: 90rpx;
  116. padding-bottom: 30rpx;
  117. .name {
  118. font-size: 42rpx;
  119. font-weight: 700;
  120. text-align: center;
  121. margin-bottom: 20rpx;
  122. }
  123. .inner {
  124. display: flex;
  125. justify-content: space-between;
  126. line-height: 40rpx;
  127. box-sizing: border-box;
  128. padding: 0 100rpx;
  129. .text {
  130. font-size: 28rpx;
  131. color: #666;
  132. }
  133. }
  134. }
  135. .result {
  136. margin-top: 20rpx;
  137. text-align: center;
  138. .text {
  139. margin-top: 20rpx;
  140. color: #52C41A;
  141. font-size: 40rpx;
  142. font-weight: 700;
  143. }
  144. }
  145. }
  146. .section_2 {
  147. margin: -26rpx auto 0;
  148. box-sizing: border-box;
  149. padding: 50rpx 20rpx;
  150. width: 650rpx;
  151. height: 420rpx;
  152. background-image: url('../icon/section_2.png');
  153. background-size: cover;
  154. .btn_list {
  155. margin-top: 50rpx;
  156. display: flex;
  157. justify-content: space-around;
  158. .btn {
  159. display: flex;
  160. align-items: center;
  161. justify-content: center;
  162. width: 270rpx;
  163. height: 100rpx;
  164. background-color: #009DD1;
  165. border-radius: 20rpx;
  166. .icon {
  167. margin-right: 20rpx;
  168. }
  169. .text {
  170. font-size: 46rpx;
  171. font-weight: 700;
  172. color: #fff;
  173. }
  174. }
  175. .btn:nth-child(2) {
  176. background-color: #FF7E00;
  177. }
  178. }
  179. }
  180. </style>