学员端小程序
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.

200 lines
5.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year 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 10" :key="index" @click="$goPage('/pages/mineEntry/myAppointment/detail/detail')">
  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 } 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: 3,
  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. this.inintList()
  71. },
  72. onPullDownRefresh() {
  73. this.inintList()
  74. },
  75. methods: {
  76. inintList() {
  77. this.params.pageNo = 1
  78. this.list = []
  79. if(this.currentTab==3) {
  80. this.examSimulationRecordFn()
  81. }else if(this.currentTab==1) {
  82. this.simulationPageFn()
  83. }
  84. },
  85. changeTab(item) {
  86. this.params.keyWord = ''
  87. this.currentTab = item.id
  88. this.$refs.searchRef.keyword = ''
  89. this.inintList()
  90. },
  91. changeNav(item) {
  92. this.currentNav = item.id
  93. this.list = []
  94. this.params.pageNo = 1
  95. if(item.id==-1) {
  96. this.params.status = ''
  97. }else {
  98. this.params.status = this.currentNav
  99. }
  100. this.inintList()
  101. },
  102. // 考场预约
  103. async examSimulationRecordFn() {
  104. const {data: res} = await examSimulationRecord(this.params)
  105. this.params.pageNo ++
  106. this.list.push(...res.list)
  107. this.total = res.total
  108. if(this.list.length>=this.total) this.status = 'nomore'
  109. },
  110. // 模拟器预约记录
  111. async simulationPageFn() {
  112. let obj = {}
  113. for(let k in this.params) {
  114. if(this.params[k]!=='') {
  115. obj[k] = this.params[k]
  116. }
  117. }
  118. const {data: res} = await simulationPage(obj)
  119. this.params.pageNo ++
  120. this.list.push(...res.list)
  121. this.total = res.total
  122. if(this.list.length>=this.total) this.status = 'nomore'
  123. },
  124. // 搜索
  125. searchFn(val) {
  126. this.params.keyWord = val
  127. this.inintList()
  128. }
  129. }
  130. }
  131. </script>
  132. <style lang="scss" scoped>
  133. .searcBox {
  134. margin: 0 0 20rpx 0;
  135. }
  136. .card {
  137. padding: 0 24rpx;
  138. margin-bottom: 20rpx;
  139. }
  140. .tabs {
  141. display: flex;
  142. width: 100%;
  143. height: 72rpx;
  144. background: #FFFFFF;
  145. border-radius: 16rpx;
  146. margin-top: 20rpx;
  147. .tab {
  148. flex: 1;
  149. text-align: center;
  150. line-height: 72rpx;
  151. color: #ADADAD;
  152. &.active {
  153. background: rgba(25,137,250,0.1);
  154. border-radius: 16rpx;
  155. border: 2rpx solid #1989FA;
  156. color: $themC;
  157. font-weight: 600;
  158. }
  159. }
  160. }
  161. .navs {
  162. display: flex;
  163. justify-content: space-between;
  164. color: #fff;
  165. font-size: 28rpx;
  166. padding: 24rpx 0 40rpx 0;
  167. color: $themC;
  168. .nav {
  169. &.active {
  170. font-weight: 500;
  171. position: relative;
  172. &::before {
  173. position: absolute;
  174. left: 50%;
  175. transform: translateX(-50%);
  176. bottom: -20rpx;
  177. content: '';
  178. width: 56rpx;
  179. height: 6rpx;
  180. background: $themC;
  181. border-radius: 3rpx;
  182. }
  183. }
  184. }
  185. }
  186. .recordTotal {
  187. font-size: 24rpx;
  188. padding: 0rpx 0 28rpx 0;
  189. text-align: right;
  190. }
  191. .pad {
  192. padding-bottom: 40rpx;
  193. }
  194. </style>