select-input-type.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <view class="page">
  3. <view class="bg-gradient"></view>
  4. <van-nav-bar title="选择录入类型" left-arrow @click-left="onBack" fixed :z-index="999" />
  5. <view class="content">
  6. <view class="student-info">
  7. <view class="info-row">
  8. <text class="label">姓名</text>
  9. <text class="value">{{ studentName }}</text>
  10. </view>
  11. <view class="info-row">
  12. <text class="label">身份证号</text>
  13. <text class="value">{{ studentIdCard }}</text>
  14. </view>
  15. </view>
  16. <view class="type-list">
  17. <view class="type-card" @click="selectType('vision')" v-if="visionStatus === 0">
  18. <view class="type-name">视力数据录入</view>
  19. <van-icon name="arrow" />
  20. </view>
  21. <view class="type-card" @click="selectType('refraction')" v-if="refractionStatus === 0">
  22. <view class="type-name">屈光度数据录入</view>
  23. <van-icon name="arrow" />
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </template>
  29. <script setup>
  30. import { getStudentInfo } from '@/services/common'
  31. const studentName = ref('')
  32. const studentIdCard = ref('')
  33. const visionStatus = ref(0)
  34. const refractionStatus = ref(0)
  35. const params = ref({})
  36. onLoad((options) => {
  37. if (options.studentId) {
  38. getStudentInfo(
  39. options.studentId
  40. ).then((res) => {
  41. studentName.value = res.data.name
  42. studentIdCard.value = res.data.id_card
  43. visionStatus.value = 0
  44. refractionStatus.value = 0
  45. params.value = res.data
  46. params.value = {
  47. studentId: res.data.id,
  48. studentName: res.data.name,
  49. studentGender: res.data.gender,
  50. studentIdCard: res.data.id_card,
  51. classId: res.data.class_id,
  52. className: res.data.class_name,
  53. grade: res.data.grade,
  54. visionDataId: res.data.vision_data_id || '',
  55. schoolName: res.data.school_name || '',
  56. userName: res.data.name || '',
  57. userPhone:'17766664444',
  58. // userOrg: options.userOrg
  59. }
  60. })
  61. }
  62. if (options.studentName) {
  63. studentName.value = decodeURIComponent(options.studentName || '')
  64. studentIdCard.value = decodeURIComponent(options.studentIdCard || '')
  65. visionStatus.value = Number(options.visionStatus || 0)
  66. refractionStatus.value = Number(options.refractionStatus || 0)
  67. params.value = {
  68. studentId: options.studentId,
  69. studentName: options.studentName,
  70. studentGender: options.studentGender,
  71. studentIdCard: options.studentIdCard,
  72. classId: options.classId,
  73. className: options.className,
  74. grade: options.grade,
  75. visionDataId: options.visionDataId || '',
  76. schoolName: options.schoolName,
  77. userName: options.userName,
  78. userPhone: options.userPhone,
  79. userOrg: options.userOrg
  80. }
  81. }
  82. })
  83. const selectType = (type) => {
  84. const url = `/pages/index/vision-input?${Object.keys(params.value).map(k => `${k}=${encodeURIComponent(params.value[k])}`).join('&')}&type=${type}`
  85. uni.navigateTo({ url })
  86. }
  87. const onBack = () => {
  88. uni.navigateBack({
  89. delta: 1,
  90. success: () => { },
  91. fail: () => {
  92. uni.switchTab({
  93. url: '/pages/index/index'
  94. })
  95. }
  96. })
  97. }
  98. </script>
  99. <style lang="scss" scoped>
  100. .page {
  101. min-height: 100vh;
  102. position: relative;
  103. }
  104. .bg-gradient {
  105. position: fixed;
  106. top: 0;
  107. left: 0;
  108. right: 0;
  109. bottom: 0;
  110. background: linear-gradient(180deg, #4A9FF5 0%, #FFFFFF 100%);
  111. z-index: 0;
  112. }
  113. .content {
  114. padding: 20rpx;
  115. padding-top: calc(20rpx + 46px);
  116. position: relative;
  117. z-index: 1;
  118. }
  119. .student-info {
  120. background: #fff;
  121. border-radius: 20rpx;
  122. padding: 30rpx;
  123. margin-bottom: 20rpx;
  124. }
  125. .info-row {
  126. display: flex;
  127. align-items: center;
  128. font-size: 28rpx;
  129. margin-bottom: 20rpx;
  130. }
  131. .info-row:last-child {
  132. margin-bottom: 0;
  133. }
  134. .label {
  135. width: 160rpx;
  136. color: #999;
  137. }
  138. .value {
  139. flex: 1;
  140. color: #333;
  141. }
  142. .type-list {
  143. display: flex;
  144. flex-direction: column;
  145. gap: 20rpx;
  146. }
  147. .type-card {
  148. background: #fff;
  149. border-radius: 20rpx;
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. padding: 50rpx 30rpx;
  154. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  155. position: relative;
  156. }
  157. .type-name {
  158. font-size: 32rpx;
  159. font-weight: bold;
  160. color: #333;
  161. flex: 1;
  162. text-align: center;
  163. }
  164. .type-card :deep(.van-icon) {
  165. position: absolute;
  166. right: 30rpx;
  167. }
  168. </style>