洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

231 lines
5.7 KiB

10 months ago
  1. <template>
  2. <view class="pageBgImg">
  3. <topNavbar title="我的预约"></topNavbar>
  4. <view class="pad">
  5. <view class="searcBox">
  6. <searchRow placeholder="搜索考场名称、车牌号" @searchFn="searchFn" ref="searchRef"/>
  7. </view>
  8. <view class="tabs">
  9. <view class="tab" v-for="(item,index) in tabList" :key="index" :class="{active: currentTab==item.id}" @click="changeTab(item)">{{ item.text }}</view>
  10. </view>
  11. <view class="navs">
  12. <view class="nav" v-for="(item,index) in navList" :key="index" :class="{active: currentNav===item.id}" @click="changeNav(item)">{{ item.text }}</view>
  13. </view>
  14. <view class="recordTotal" v-if="total">{{total}}条记录</view>
  15. <view class="tabCon" v-show="currentTab==1">
  16. <view class="card" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail?type=1&id='+item.id)">
  17. <imitate :item="item"></imitate>
  18. </view>
  19. </view>
  20. <view class="tabCon" v-if="currentTab==2">
  21. <view class="card" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail?type=2&id='+item.id)">
  22. <opera :item="item"></opera>
  23. </view>
  24. </view>
  25. <view class="tabCon" v-if="currentTab==3">
  26. <view class="card" v-for="(item,index) in list" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail?type=3&id='+item.id)">
  27. <examin :item="item"></examin>
  28. </view>
  29. </view>
  30. <view style="padding: 10rpx 0 20rpx 0;" v-if="list.length">
  31. <u-loadmore :status="status" />
  32. </view>
  33. <nodata v-if="!list.length&&status=='nomore'"></nodata>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import imitate from './comp/imitate'
  39. import opera from './comp/opera'
  40. import examin from './comp/examin'
  41. import { examSimulationRecord, simulationPage, masterPage } from '@/config/api.js'
  42. export default {
  43. components: { imitate, opera, examin},
  44. data() {
  45. return {
  46. tabList: [
  47. {text: '模拟器',id: 1},
  48. {text: '实操训练',id: 2},
  49. {text: '考场模拟',id: 3},
  50. ],
  51. navList: [
  52. {text: '全部', id: -1},
  53. {text: '已签到', id: 1},
  54. {text: '待完成', id: 0},
  55. {text: '已取消', id: 9},
  56. {text: '已过期', id: 3},
  57. ],
  58. // 0:未签到,1:已签到,2:已签退,3:旷课,9:已取消
  59. currentTab: 2,
  60. currentNav: 0,
  61. params: { "pageNo": 1, "pageSize": 10, "keyWord": "", "status": '0',studentId: '', keyWord: ''},
  62. list: [],
  63. total: 20,
  64. status: 'loading'
  65. }
  66. },
  67. onLoad(options) {
  68. if(options.currentTab) this.currentTab = options.currentTab
  69. this.params.studentId = this.studentId
  70. },
  71. onShow() {
  72. this.inintList()
  73. },
  74. onReachBottom() {
  75. if(this.total>this.list.length) {
  76. this.inintList('onReachBottom')
  77. }
  78. },
  79. onPullDownRefresh() {
  80. this.inintList()
  81. },
  82. methods: {
  83. inintList(type) {
  84. if(!type) {
  85. this.params.pageNo = 1
  86. this.list = []
  87. this.total = 0
  88. }
  89. if(this.currentTab==3) {
  90. this.examSimulationRecordFn()
  91. }else if(this.currentTab==1) {
  92. this.simulationPageFn()
  93. }else {
  94. this.masterPageFn()
  95. }
  96. },
  97. changeTab(item) {
  98. this.params.keyWord = ''
  99. this.currentTab = item.id
  100. this.$refs.searchRef.keyword = ''
  101. this.inintList()
  102. },
  103. changeNav(item) {
  104. this.currentNav = item.id
  105. this.list = []
  106. this.params.pageNo = 1
  107. if(item.id==-1) {
  108. this.params.status = ''
  109. }else {
  110. this.params.status = this.currentNav
  111. }
  112. this.inintList()
  113. },
  114. // 考场预约
  115. async examSimulationRecordFn() {
  116. const {data: res} = await examSimulationRecord(this.params)
  117. this.params.pageNo ++
  118. this.list.push(...res.list)
  119. this.total = res.total
  120. if(this.list.length>=this.total) this.status = 'nomore'
  121. },
  122. // 模拟器预约记录
  123. async simulationPageFn() {
  124. let obj = {}
  125. for(let k in this.params) {
  126. if(this.params[k]!=='') {
  127. obj[k] = this.params[k]
  128. }
  129. }
  130. const {data: res} = await simulationPage(obj)
  131. this.params.pageNo ++
  132. this.list.push(...res.list)
  133. this.total = res.total
  134. if(this.list.length>=this.total) this.status = 'nomore'
  135. },
  136. // 实操预约
  137. async masterPageFn() {
  138. let obj = {}
  139. for(let k in this.params) {
  140. if(this.params[k]!=='') {
  141. obj[k] = this.params[k]
  142. }
  143. }
  144. const {data: res} = await masterPage(obj)
  145. this.params.pageNo ++
  146. this.list.push(...res.list)
  147. this.total = res.total
  148. if(this.list.length>=this.total) this.status = 'nomore'
  149. },
  150. // 搜索
  151. searchFn(val) {
  152. this.params.keyWord = val
  153. this.inintList()
  154. }
  155. }
  156. }
  157. </script>
  158. <style lang="scss" scoped>
  159. .searcBox {
  160. margin: 0 0 20rpx 0;
  161. }
  162. .card {
  163. padding: 0 24rpx;
  164. margin-bottom: 20rpx;
  165. }
  166. .tabs {
  167. display: flex;
  168. width: 100%;
  169. height: 72rpx;
  170. background: #FFFFFF;
  171. border-radius: 16rpx;
  172. margin-top: 20rpx;
  173. .tab {
  174. flex: 1;
  175. text-align: center;
  176. line-height: 72rpx;
  177. color: #ADADAD;
  178. &.active {
  179. background: rgba(25,137,250,0.1);
  180. border-radius: 16rpx;
  181. border: 2rpx solid #1989FA;
  182. color: $themC;
  183. font-weight: 600;
  184. }
  185. }
  186. }
  187. .navs {
  188. display: flex;
  189. justify-content: space-between;
  190. color: #fff;
  191. font-size: 28rpx;
  192. padding: 24rpx 0 40rpx 0;
  193. color: $themC;
  194. .nav {
  195. height: 80rpx;
  196. line-height: 80rpx;
  197. padding: 0 20rpx;
  198. &.active {
  199. font-weight: 500;
  200. position: relative;
  201. &::before {
  202. position: absolute;
  203. left: 50%;
  204. transform: translateX(-50%);
  205. bottom: 0;
  206. content: '';
  207. width: 56rpx;
  208. height: 6rpx;
  209. background: $themC;
  210. border-radius: 3rpx;
  211. }
  212. }
  213. }
  214. }
  215. .recordTotal {
  216. font-size: 24rpx;
  217. padding: 0rpx 0 28rpx 0;
  218. text-align: right;
  219. }
  220. .pad {
  221. padding-bottom: 40rpx;
  222. }
  223. </style>