index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="window-box">
  3. <ly-back :showBack="false"/>
  4. <view class="search w100 h100 flex-center-center main">
  5. <view class="w60 h60 bg2 flex-center-center flex-wrap flex-dir-column">
  6. <view>请将卡片放入感应区</view>
  7. <view >
  8. <uv-image :src="pD.imgUrl+ '/index-card.png'" width="500px" height="306px"></uv-image>
  9. </view>
  10. </view>
  11. <view class="btn btn-primary" @click="search">扫码</view>
  12. <view class="btn btn-primary" @click="next">下一页</view>
  13. <!-- <view class="btn btn-primary" @click="toSelect">手动选择</view>-->
  14. </view>
  15. </view>
  16. </template>
  17. <script setup>
  18. import {reactive} from "vue";
  19. import {navTo, showToast} from "@/utils/app";
  20. import {cradToStudentInfo} from "@/api/student";
  21. import storage from "@/utils/storage";
  22. const pD = reactive({
  23. title: '学生未激活',
  24. select: 0,
  25. selectMax: 1,
  26. imgUrl:'/static',
  27. })
  28. const queryForm = reactive({
  29. student_id: 0,
  30. })
  31. const search = async () => {
  32. const {code, msg, data} = await cradToStudentInfo({
  33. mac: 'BBBBBBBBBBBB'
  34. })
  35. if (code === 1) {
  36. queryForm.student_id = data.student.id
  37. storage.setKey(`student-${data.student.id}`)
  38. navTo('pages/task/info', {
  39. id: queryForm.student_id,
  40. })
  41. } else {
  42. showToast(msg)
  43. }
  44. // navTo('pages/task/info')
  45. }
  46. const next = ()=>{
  47. navTo('pages/task/info', {
  48. id: queryForm.student_id,
  49. })
  50. }
  51. const toSelect = () => {
  52. navTo('pages/classes/select')
  53. }
  54. </script>
  55. <style lang="scss" scoped>
  56. .main{
  57. background-image: url('static/index-bg.png');
  58. width: 100%;
  59. height: 100%;
  60. background-position: center center;
  61. background-size: 100%;
  62. background-repeat: no-repeat;
  63. }
  64. .bg2{
  65. background-image: url('static/index-bg2.png');
  66. width: 80%;
  67. height: 80%;
  68. background-position: center center;
  69. background-size: 100%;
  70. background-repeat: no-repeat;
  71. }
  72. .info-item {
  73. display: flex;
  74. align-items: center;
  75. margin-bottom: 30rpx;
  76. &-label {
  77. margin-right: 50rpx;
  78. }
  79. }
  80. </style>