info.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. <template>
  2. <view class="window-box dis-flex">
  3. <ly-back :autoBack="false" @backClick="backClick"/>
  4. <view v-if="countDown > 0" class="countDown">{{ formatZero(countDown, 2) }}</view>
  5. <view class="window w40 flex-center-center flex-dir-column">
  6. <student-info :student="student"/>
  7. </view>
  8. <view class="w60 h100 dis-flex flex-x-center flex-dir-column">
  9. <template v-if="configStore.mType === 7">
  10. <view class="info-item">
  11. <view class="info-item-label">身高</view>
  12. <view class="">
  13. <view class="col-checked f-64">{{ queryForm.value1 }}</view>
  14. </view>
  15. </view>
  16. <view class="info-item">
  17. <view class="info-item-label">体重</view>
  18. <view class="">
  19. <view class="col-checked f-64">{{ queryForm.value2 }}</view>
  20. </view>
  21. </view>
  22. </template>
  23. <view v-if="configStore.mType === 8" class="info-item">
  24. <view class="info-item-label">肺活量</view>
  25. <view class="">
  26. <view class="btn btn-primary">进入肺活量</view>
  27. </view>
  28. </view>
  29. <view v-if="configStore.mType === 9" class="info-item">
  30. <view class="info-item-label">视力</view>
  31. <view class="">
  32. <view class="btn btn-primary">进入视力</view>
  33. </view>
  34. </view>
  35. <!-- <view class="info-item" @click="toTask(10)">-->
  36. <!-- <view class="btn btn-primary">进入测试</view>-->
  37. <!-- </view>-->
  38. </view>
  39. <ly-modal ref="modelRef"></ly-modal>
  40. </view>
  41. </template>
  42. <script setup>
  43. import {onActivated, onMounted, reactive, ref} from "vue";
  44. import {formatZero} from "@/utils/util";
  45. import {useConfigStore} from "@/store/useConfigStore";
  46. import {confirmModal, getBeforePage, navTo, redirectTo, showToast} from "@/utils/app";
  47. import debounce from "@/utils/debounce";
  48. import studentInfo from "./studentInfo"
  49. import storage from "@/utils/storage";
  50. const configStore = useConfigStore()
  51. const countDown = ref(0)
  52. const debounces = new debounce()
  53. const modelRef = ref()
  54. let student = reactive({
  55. jname: '未识别',
  56. gender: 1,
  57. })
  58. const queryForm = reactive({
  59. student_id: 0,
  60. value1: 0,
  61. value2: 0,
  62. })
  63. const search = () => {
  64. queryForm.student_id = 2260
  65. }
  66. const backClick = () => {
  67. console.log('modelRef', modelRef, modelRef.value.open)
  68. modelRef.value.open({
  69. title: '温馨提示',
  70. content: '确认要退出吗?',
  71. showCancelButton: true,
  72. })
  73. // confirmModal('请认要退出吗?').then(() => {
  74. // redirectTo('pages/index/index')
  75. // }, () => {
  76. // })
  77. }
  78. const logout = () => {
  79. storage.remove(`student-${student.id}`)
  80. redirectTo('pages/index/index')
  81. }
  82. const countDownHandle = () => {
  83. countDown.value = 30
  84. debounces.countDown('countDown', {
  85. duration: 30000,
  86. callback: () => {
  87. countDown.value--
  88. },
  89. endCallback: () => {
  90. // 清空缓存学生信息
  91. // logout()
  92. },
  93. })
  94. }
  95. // 挂载完成之后
  96. onMounted((r) => {
  97. // student = storage.getKey(`student-${r.id}`)
  98. countDownHandle()
  99. })
  100. // 激活页面时
  101. onActivated(() => {
  102. })
  103. </script>
  104. <style lang="scss" scoped>
  105. .container {
  106. width: 100vw;
  107. height: 100vh;
  108. max-width: 100vw;
  109. max-height: 100vh;
  110. overflow: hidden;
  111. }
  112. .info-item {
  113. display: flex;
  114. align-items: center;
  115. margin-bottom: 30rpx;
  116. &-label {
  117. margin-right: 50rpx;
  118. }
  119. }
  120. .countDown {
  121. width: 130rpx;
  122. height: 130rpx;
  123. position: fixed;
  124. top: 20rpx;
  125. right: 20rpx;
  126. border: 6rpx solid green;
  127. color: green;
  128. border-radius: 50%;
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. font-size: 60rpx;
  133. }
  134. </style>