carManager.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view class="content main">
  3. <app-header @back="back">
  4. 车辆信息管理
  5. </app-header>
  6. <view class="btn" @click="reservation">
  7. <view class="res">
  8. <view class="icon"></view>
  9. <view class="title">
  10. <view class="zh">在线预约</view>
  11. <view class="en">Online Booking</view>
  12. </view>
  13. <view class="arrow"></view>
  14. </view>
  15. </view>
  16. <view class="btn" @click="scan">
  17. <view class="scan">
  18. <view class="icon"></view>
  19. <view class="title">
  20. <view class="zh">扫码登记</view>
  21. <view class="en">Scan Code Registrantion</view>
  22. </view>
  23. <view class="arrow"></view>
  24. </view>
  25. </view>
  26. <tabbar></tabbar>
  27. </view>
  28. </template>
  29. <script>
  30. import { HOME_INDEX, CAR_INDEX, MONITOR_INDEX, LIVE_INDEX } from '@/config/constants'
  31. import appHeader from '@/pages/components/header/header.vue'
  32. import tabbar from '@/pages/components/tabbar.vue'
  33. export default {
  34. components: {appHeader, tabbar},
  35. data() {
  36. return {
  37. }
  38. },
  39. methods: {
  40. back() {
  41. getApp().globalData.tabIndex = HOME_INDEX
  42. uni.redirectTo({
  43. url: '/pages/home/home'
  44. })
  45. },
  46. reservation() {
  47. uni.navigateTo({
  48. url: '/pages/reservation/reservation'
  49. })
  50. },
  51. scan() {
  52. // #ifdef APP
  53. uni.scanCode({
  54. scanType: ['qrCode'],
  55. success: (resp) => {
  56. console.log(resp);
  57. try {
  58. const r = JSON.parse(resp.result)
  59. if(r.type === 'registration') {
  60. uni.navigateTo({
  61. url: '/pages/registration/registration'
  62. })
  63. }else {
  64. throw '-1'
  65. }
  66. }catch(_) {
  67. uni.showToast({
  68. title: '无法识别二维码',
  69. icon: 'error'
  70. })
  71. }
  72. },
  73. fail: () => {
  74. uni.showToast({
  75. title: '无法获取摄像头',
  76. icon: 'error'
  77. })
  78. }
  79. })
  80. // #endif
  81. // #ifdef H5
  82. uni.navigateTo({
  83. url: '/pages/registration/registration'
  84. })
  85. // #endif
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .main {
  92. background-color: #f0f1f2;
  93. height: 100vh;
  94. // .header {
  95. // background: url('~@/static/login-bg-top.jpg') no-repeat;
  96. // color: white;
  97. // height: 80px;
  98. // display: flex;
  99. // justify-content: center;
  100. // align-items: center;
  101. // font-size: 20px;
  102. // }
  103. }
  104. .btn {
  105. margin: 20px;
  106. .res {
  107. background-image: linear-gradient(to bottom, #e8eefe, #fff);
  108. min-height: 200px;
  109. border-radius: 10px;
  110. display: flex;
  111. justify-content: space-around;
  112. align-items: center;
  113. .icon {
  114. background: url('~@/static/res-icon.png') no-repeat;
  115. background-size: 100% 100%;
  116. width: 80px;
  117. height: 80px;
  118. }
  119. .arrow {
  120. background: url('~@/static/res-arrow.png') no-repeat;
  121. background-size: 100% 100%;
  122. width: 30px;
  123. height: 30px;
  124. }
  125. }
  126. .scan {
  127. background-image: linear-gradient(to bottom, #e2f7f1, #fff);
  128. min-height: 200px;
  129. border-radius: 10px;
  130. display: flex;
  131. justify-content: space-around;
  132. align-items: center;
  133. .icon {
  134. background: url('~@/static/scan-icon.png') no-repeat;
  135. background-size: 100% 100%;
  136. width: 80px;
  137. height: 80px;
  138. }
  139. .arrow {
  140. background: url('~@/static/scan-arrow.png') no-repeat;
  141. background-size: 100% 100%;
  142. width: 30px;
  143. height: 30px;
  144. }
  145. }
  146. .title {
  147. .zh {
  148. font-size: 30px;
  149. }
  150. .en {
  151. font-size: 10px;
  152. color: #bfc4cd;
  153. }
  154. }
  155. }
  156. </style>