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

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