options.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <template>
  2. <view class="page-container uni-column">
  3. <view class="option-container uni-column">
  4. <!-- tab-bar -->
  5. <view class="tab-bars uni-row">
  6. <view :class="currentTabName === 1 ? 'active' : ''" @click.stop="handleTabBarClick(1)">
  7. <text>检查指导书</text>
  8. <view class="line"></view>
  9. </view>
  10. <view :class="currentTabName === 2 ? 'active' : ''" @click.stop="handleTabBarClick(2)">
  11. <text>分选标准</text>
  12. <view class="line"></view>
  13. </view>
  14. </view>
  15. <!-- 搜索框 -->
  16. <view class="search-container uni-row">
  17. <input type="text" v-model="keywords" placeholder="请输入编号/关键字" />
  18. <view class="btn">搜索</view>
  19. </view>
  20. <!-- 选项 -->
  21. <view class="option-item" v-for="(item, index) in optionList" :key="index" @click="handleOptionChecked(item)">
  22. <view class="uni-row">
  23. <view class="label">检查项</view>
  24. <view class="value">{{ item.title }}</view>
  25. </view>
  26. <view class="uni-row">
  27. <view class="label">检查标准</view>
  28. <view class="value">{{ item.standard }}</view>
  29. </view>
  30. <uni-icons class="arrow-right" type="right" size="24" />
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script setup>
  36. import { ref } from 'vue'
  37. import { onLoad, onReady, onUnload, onShow } from '@dcloudio/uni-app'
  38. const currentTabName = ref(1)
  39. const keywords = ref('')
  40. const optionList = ref([])
  41. // 检查指导书
  42. const optionList1 = ref([])
  43. // 分选标准
  44. const optionList2 = ref([])
  45. // 页面生命周期函数
  46. onLoad(() => {
  47. optionList1.value = [
  48. {
  49. title: '001 台阶径',
  50. standard: '角偏 < 0.05'
  51. },
  52. {
  53. title: '002 台阶径',
  54. standard: '角偏 < 0.04'
  55. }
  56. ]
  57. optionList2.value = [
  58. {
  59. title: '划痕',
  60. standard: '划痕描述'
  61. },
  62. {
  63. title: '划伤',
  64. standard: '划伤描述'
  65. }
  66. ]
  67. optionList.value = optionList1.value
  68. })
  69. // tabbar切换
  70. const handleTabBarClick = (val) => {
  71. switch (val) {
  72. case 1:
  73. optionList.value = optionList1.value
  74. break
  75. case 2:
  76. optionList.value = optionList2.value
  77. }
  78. currentTabName.value = val
  79. }
  80. const handleOptionChecked = (data) => {
  81. uni.$emit('addUnfitInfoEvent', {
  82. title: data.title,
  83. standard: data.standard
  84. })
  85. uni.navigateBack()
  86. }
  87. </script>
  88. <style lang="scss">
  89. .page-container {
  90. height: 100%;
  91. background-color: #ececec;
  92. font-size: 28rpx;
  93. padding: 24rpx;
  94. box-sizing: border-box;
  95. }
  96. .option-container {
  97. background-color: #ffffff;
  98. padding: 24rpx;
  99. border-radius: 12rpx;
  100. }
  101. .tab-bars {
  102. height: 56rpx;
  103. > view {
  104. flex: 1;
  105. text-align: center;
  106. .line {
  107. width: 50%;
  108. height: 2px;
  109. margin:8rpx auto 0 auto;
  110. background-color: #FFFFFF;
  111. }
  112. &.active {
  113. .line {
  114. background-color: #1684FC;
  115. }
  116. }
  117. }
  118. }
  119. .search-container {
  120. margin-top: 16rpx;
  121. align-items: center;
  122. input {
  123. flex: 1;
  124. height: 72rpx;
  125. border: 1px solid #bbbbbb;
  126. padding: 0 8rpx;
  127. box-sizing: border-box;
  128. }
  129. .btn {
  130. display: flex;
  131. flex-direction: row;
  132. width: 112rpx;
  133. height: 72rpx;
  134. align-items: center;
  135. justify-content: center;
  136. background-color: #1684FC;
  137. color: #ffffff;
  138. }
  139. }
  140. .option-item {
  141. position: relative;
  142. margin-top: 24rpx;
  143. padding-bottom: 8rpx;
  144. border-bottom: 1px solid #BBBBBB;
  145. .uni-row {
  146. padding-bottom: 16rpx;
  147. .label {
  148. width: 144rpx;
  149. }
  150. .value {
  151. flex: 1;
  152. }
  153. }
  154. .uni-row:first-child {
  155. font-size: 32rpx;
  156. font-weight: 700;
  157. }
  158. .arrow-right {
  159. position: absolute;
  160. top: 24rpx;
  161. right: 24rpx;
  162. }
  163. }
  164. </style>